Discussion
Welcome to Absolute Web Dev Forum. Feel free to Register and ask me a question about web development or, if you can answer or contribute to the aswering of someones question, feel free to respond. All listings are reviewed by me so please make your comments usefull. If you will, please leave links to related websites or other references that someone can go to for further information on a given subject. Thank you for your contribution to Absolute Web Devs Web Forum.Create Discussion
Can I store HTML code in a mysql database?
|
Sandy |
Can I store HTML code in a mysql database? - 02/14/2009 I was thinking of writing code for certain pages in my webpage and I wanted to use mysql to hold the code data. I tried to insert some code into my database, but I kept getting error messages. Is there something I am doing wrong or is code something mysql databases can’t do? |
|
WebMaster |
Response - 02/14/2009 Yes you can store code into your database. You must use the addslashes() function to your data and convert all (') single quotes into the correct character entity. The correct entity for (') is ' I would convert all characters that might cause issues in a database; but, the single quote will definitely cause a problem. Depending what you are doing, you might need to use the html_special_chars() function also. You shouldn't need to convert the (") double quotes that are required in html tags. For example the image tag <img src="mygif.gif" />. This should be just fine in your database. |
TOP








