conan318 Posted August 5, 2011 Share Posted August 5, 2011 does the varchar not allow qoutes?? example August 28th an Out N' back from the Station departing 8 AM. Then, September 11th and October 16th We also have a fair crew riding Wollomi Wild Ride so sign up on line this give's an error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2011/08/05')' at line 1 remove the qoute ' and it works fine August 28th an Out N back from the Station departing 8 AM. Then, September 11th and October 16th We also have a fair crew riding Wollomi Wild Ride so sign up on line Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 you need to escape your string. check out addslashes and stripslashes Quote Link to comment Share on other sites More sharing options...
conan318 Posted August 5, 2011 Author Share Posted August 5, 2011 topic solved once again thanks mate Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 mysql_real_escape_string before entering it into the sql table, and do stripslashes when displaying it. By escaping the quotes, you are preventing it from breaking the code. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 6, 2011 Share Posted August 6, 2011 If the data is escaped properly, there should be no need to use stripslashes(). Slashes aren't stored with the data unless it somehow ends up double escaped. Which brings up the point that addslashes() shouldn't be used when there's a db specific escaping function available, such as mysql_real_escape_string(). Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 If the data is escaped properly, there should be no need to use stripslashes(). Slashes aren't stored with the data unless it somehow ends up double escaped. Which brings up the point that addslashes() shouldn't be used when there's a db specific escaping function available, such as mysql_real_escape_string(). If that's the case then OP you should be checking if magic_quotes_gpc is on or not (off usually), since if you do get double escaped you would need the strip slashes. f\\'oo Quote Link to comment Share on other sites More sharing options...
conan318 Posted August 6, 2011 Author Share Posted August 6, 2011 i just used this $data = mysql_real_escape_string($data); and is all working good Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 haha, can't argue with mysql_real_escape_string. 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.