Page 1 of 1
help in apostrophes
Posted: Wed Jun 11, 2008 9:43 pm
by tabatsoy
greetings Earthlings!!!!
when i put an apostrophe on my form(eg. o'mg) and hit submit button it says "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 ''''' at line 5"
Please Help
Re: help in apostrophes
Posted: Wed Jun 11, 2008 9:46 pm
by hansford
use addslashes() on all of your $_POSTS before querying or adding to DB, then use stripslashes() when pulling them out of DB
Re: help in apostrophes
Posted: Wed Jun 11, 2008 9:50 pm
by superdezign
Use
mysql_real_escape_string() instead of addslashes().
Re: help in apostrophes
Posted: Wed Jun 11, 2008 9:54 pm
by tabatsoy
thanks earthlings
i love this planet

Re: help in apostrophes
Posted: Thu Jun 12, 2008 1:42 am
by hansford
well I've being countered by superdezign on my last 2 posts so, I will have to re-evalute my responses befoe posting. I have < 100 and he has > 3000, who you gunna trust?
Re: help in apostrophes
Posted: Thu Jun 12, 2008 5:49 am
by superdezign
Hehe, we all learn from each other. Most of what I know, I learned here.
Even if you are wrong (or in your cases, just slightly off), posting what you think is right is the best way to find out what actually is right.
Re: help in apostrophes
Posted: Thu Jun 12, 2008 7:23 am
by hansford
This article is worth reading and a good example of why I took back my comment on using addslashes() after superdezigns remarks.
http://shiflett.org/blog/2006/jan/addsl ... ape-string