leest Posted July 21, 2008 Share Posted July 21, 2008 OK, thought i had solved this problem but i hadn't. Anyway the insert query works fine, however i need to put the information in to the mysql database contained in "". This php code works fine: $query = "INSERT INTO dashboard_component (module_name, module_parameters, site_id, column_number, position) VALUES ('text', 'Welcome,((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))', '$site_id', 0, 1)"; mysql_query($query) or die(mysql_error()); now when i re-write the code like this to try and enter the data in to the table within "", it fails, when the page is called, it just returns a blank page. ('text', '"Welcome,((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))"', '$site_id', 0, 1)"; Any suggestions will be much appreciated, thanks Quote Link to comment Share on other sites More sharing options...
mbeals Posted July 21, 2008 Share Posted July 21, 2008 your query string in php is delimited by double quotes, so php is puking when it hits them. You need to escape them with a \. The slash will vanish once php parses the string so they shouldn't wind up in the database. Quote Link to comment Share on other sites More sharing options...
leest Posted July 21, 2008 Author Share Posted July 21, 2008 Thanks worked perfectly, Quote Link to comment 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.