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
help in apostrophes
Moderator: General Moderators
Re: help in apostrophes
use addslashes() on all of your $_POSTS before querying or adding to DB, then use stripslashes() when pulling them out of DB
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help in apostrophes
Use mysql_real_escape_string() instead of addslashes().
Re: help in apostrophes
thanks earthlings
i love this planet
i love this planet
Re: help in apostrophes
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?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help in apostrophes
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.
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
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
http://shiflett.org/blog/2006/jan/addsl ... ape-string