Inserting a field with ""

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

Inserting a field with ""

Post 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
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Look into mysql_real_escape_string(), addslashes() and stripslashes().
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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!
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post 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 ;)
Post Reply