RE: [PHP-DB] stripSlashes function

From: Date: Mon, 20 May 2002 08:33:44 +0000
Subject: RE: [PHP-DB] stripSlashes function
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19267@lists.php.net to get a copy of this message
You need to add slashes when putting data into your database. When you want to display the data from your database, that's when you strip the slashes. -----Original Message----- From: Lisi [mailto:lists@shemeshdirectory.co.il] Sent: May 20, 2002 5:33 AM To: php-db@lists.php.net Subject: [PHP-DB] stripSlashes function I have a form that allows a person to enter an announcement into a database using a form. The form and the query work fine. $query = "INSERT INTO maztov (fullname1, fullname2, city1, city2, email1, email2, post_fullname, mazal_text, post_city, post_email, other_emails, entered) VALUES ('$fullname1','$fullname2','$city1','$city2','$ema il1','$email2','$post_fullname','$mazal_text','$po st_city','$post_email','$other_emails', NOW())"; $result = mysql_query($query); Then I realized MagicQuotes was adding slashes to my query, so I added this line: $query = stripSlashes($query); before I executed the result. Now the result is no longer executing, i.e. the entry is not being added into the database. When I echo the query before and after stripslashes has been applied, it is echoing exactly what I think it should. When I comment out the line with stripslashes, it works again but with adding quotes. What am I doing wrong? Thanks, -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/02

« previous php.db (#19267) next »