Hi, addslashes() works fine for me( and as John said i dint need to use stripslashes) NOW( :( ) whats happening is if i *want* to add a backslash in the string that also gets stripped off (as i have to specify many windows paths e.g. c:\niksun\config\ ). Is there any fix to this of its a trade off between ',",... and \ ?
Note: putting a \\ to add \ doesnt help coz for one time it works one i open the entry in edit mode again i have to put \ before all the \. please help regards anil ----- Original Message ----- From: "1LT John W. Holmes" <[EMAIL PROTECTED]> To: "Martin Clifford" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, July 12, 2002 12:12 PM Subject: Re: [PHP] ' giving problem while inserting in table. > You DON'T have to use stripslashes() on data coming out of a database. The > slashes were there to escape certain characters so they could make it into > the database. The actual slashes do not go into the database. If they are in > your case, then you're using addslashes() twice, somehow. The only time you > have to use stripslashes on database data is if your magic_quotes_runtime > setting is on in php.ini. > > ---John Holmes... > > ----- Original Message ----- > From: "Martin Clifford" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, July 12, 2002 10:49 AM > Subject: Re: [PHP] ' giving problem while inserting in table. > > > Use addslashes() on ALL strings before inserting them into your database. > Then, on your frontend, extract the data and use stripslashes() on all > strings. > > Hope to help! > > Martin Clifford > Homepage: http://www.completesource.net > Developer's Forums: http://www.completesource.net/forums/ > > > >>> "Anil Garg" <[EMAIL PROTECTED]> 07/12/02 10:45AM >>> > Hi, > I am making a faq maintenance system using mysql and php. > To insert a entry in to a faq table i am using the following query: > --------- > INSERT INTO faq_table_netvd (id,question, > answer,netvcr,netdetector,add_date,mod_date,keyword,category,display,attach_ > id) > VALUES ('0','$frm[question]', > '$frm[answer]','$frm[netvcr]','$frm[netdetector]','$frm[add_date]','$frm[mod > _date]','$frm[keyword]','$frm[category]','$frm[display]','$frm[attach_id]') > "); > ----------- > now the problem is when $frm[question] has some string like: "why i can't > eat". > i get the following error: > MySQL Error: You have an error in your SQL syntax near 't eat?' ,answer = > 'Please recheck the power of your specs:)' ' at line 3.Putting a '\' before > ' (e.g. \')solves my problem...but when i open the same quesion to edit it, > again i have to put backslashes where ever i find " ' " in the quesion or > answer. > > Can anyone please suggest a solution to this. > > thanx and regards > > anil > > [please ask if i havent explained the problem fully] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php