Page 1 of 1

Inserting a field with ""

Posted: Tue Mar 21, 2006 7:09 am
by vivekjain
Hi,
I am writing an application using PHP and MySQL. I need to enter a varchar field into the db which has this value

"3/4" Drive pneumatic impact drivers CC# 5200552", i.e. 3/4 has " next to it, and because of this it is throwing an error. Can anyone sugget me how to work on this.

Thanks

Posted: Tue Mar 21, 2006 7:18 am
by jayshields
Look into mysql_real_escape_string(), addslashes() and stripslashes().

Posted: Tue Mar 21, 2006 7:19 am
by shiznatix
mysql_real_escape_string()
OR
addslashes()

but use mysql_real_escape_string(), if you want to know more search the security forum, there is a example of why you should use that instead of addslashes()

edit: twice i have been beaten today! ill get you guys yet!

Posted: Tue Mar 21, 2006 9:55 am
by Maugrim_The_Reaper
Strike at Lunch time GMT - it coincides with early morning elsewhere. You might get in a few first time replies before feyd turns up ;)