Re: addslashes/stripslashes

From: Date: Tue, 05 Nov 2002 15:59:12 +0000
Subject: Re: addslashes/stripslashes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-122789@lists.php.net to get a copy of this message
Paul Dionne wrote: > Hey, > > I am trying to develop a search for my database. > > I used addslashes when entering the data, and then use addslashes > with the search but nothing comes up: > Select * from tblContacts, tblCountries WHERE > (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization > LIKE '%o\'mallies%' ) I think your query goes wrong, because MySQL uses two single quotes instead of backslash quote. So, try using Select * from tblContacts, tblCountries WHERE (tblContacts.CountryCode=tblCountries.CountryID) AND (Organization LIKE "%o\'mallies%" ). > > I check in the database and o'mallies is indeed there as o\'mallies. > And a search for just mallies works fine. Because the data is save with the \ and with the ', you'll probably have to change your search to LIKE "%o\\''mallies%" ). Try using mysql_escape_string instead of addslashes to store the o'mallies as is, without the \. HTH Erwin

« previous php.general (#122789) next »