bigjoe11a Posted March 7, 2011 Share Posted March 7, 2011 What I'm trying to do is insert a HTML page into a mysql database and with no luck. Can some one show me how to do this. insert into 'templates'('name','template') values ('header',' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="javascript" src="click.js"></script> <link href="styles.css" rel="stylesheet" type="text/css"> <title>{SITE_TITLE}</title> </head> <body> <table width="99%" align="center" height="82" border="0" cellpadding="0" cellspacing="0" class="header"> <tr> <td align="center"><h1>{SITE_NAME}</h1></td> </tr> </table> '); Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/ Share on other sites More sharing options...
fenway Posted March 7, 2011 Share Posted March 7, 2011 Ignoring the fact that this isn't a good idea in the first place, the issue is likely quoting. You need mysql_real_escape_string(). Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184028 Share on other sites More sharing options...
bigjoe11a Posted March 7, 2011 Author Share Posted March 7, 2011 Ignoring the fact that this isn't a good idea in the first place, the issue is likely quoting. You need mysql_real_escape_string(). Explain. Why won't it be a good idea. Since there are CMS in PHP that use this option. and can you give me a sample of how to use mysql_real_escape_string(). Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184048 Share on other sites More sharing options...
fenway Posted March 7, 2011 Share Posted March 7, 2011 Making changes to HTML templates hiding in an DB is just hard for no reason. There are countless examples of using that quoting function on this forum. Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184061 Share on other sites More sharing options...
bigjoe11a Posted March 7, 2011 Author Share Posted March 7, 2011 Thanks any way. I'm just not going to take time out to look threw 100's of pages just to find one sample. Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184073 Share on other sites More sharing options...
fenway Posted March 7, 2011 Share Posted March 7, 2011 There's always the PHP refman. Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184074 Share on other sites More sharing options...
TOA Posted March 7, 2011 Share Posted March 7, 2011 http://tinyurl.com/4gheumd love that Quote Link to comment https://forums.phpfreaks.com/topic/229879-inserting-a-page-into-a-mysql-database/#findComment-1184092 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.