runeveryday Posted March 18, 2010 Share Posted March 18, 2010 $sql = 'INSERT INTO joke SET joketext="' . $joketext . '", jokedate="today's date"'; i don't understand the line joketext="' . $joketext . '", why it use the single quote and the concatenation . i feel those are a surplus, use this is joketext="$joketext ", ok, but when i test it ,it's show an error, anyone can tell me the reason.any tips would be appreciated. Quote Link to comment Share on other sites More sharing options...
trq Posted March 18, 2010 Share Posted March 18, 2010 Your getting an error because of the ' in today's Quote Link to comment Share on other sites More sharing options...
Kryptix Posted March 18, 2010 Share Posted March 18, 2010 Use this: $sql = "INSERT INTO `joke` SET `joketext` = '" . $joketext . "', `jokedate` = 'today\'s date';"; Quote Link to comment Share on other sites More sharing options...
fenway Posted March 22, 2010 Share Posted March 22, 2010 Or actually escape your input data properly. 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.