RE: [PHP] strip single quotes
| From: | Martin Towell | Date: | Thu, 20 Mar 2003 02:50:32 +0000 |
| Subject: | RE: [PHP] strip single quotes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140388@lists.php.net to get a copy of this message | ||
try this
$address2 = str_replace("'", "''", $address)
-----Original Message-----
From: Daniel McCullough [mailto:daniel_mccullough@hotmail.com]
Sent: Thursday, March 20, 2003 1:48 PM
To: php-general@lists.php.net
Subject: [PHP] strip single quotes
I'm trying to query the database using a string pulled out of the database
and compare and get the id. I can do it to a certain point and what kills
my query is single quotes. I CANNOT figure out how to escape it.
I DID THIS:
$address2 = str_replace("'", "", $address);
that worked on some, but not all.
$address = stripslashes($store['address']);
$address = str_replace("'", "", $address);
$address = htmlspecialchars($address);
$address = addslashes($address);
anyone
Some errors I have gotten back
"You have an error in your SQL syntax near 's Linen & Home'' at line 1"
and
"You have an error in your SQL syntax near 's 800 number.'' at line 1"
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php