> 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 check in the database and o'mallies is indeed there as o\'mallies. And
> search for just mallies works fine.
If you see it in the database as o\'mallies, then you are running
addslashes() twice on the data you are inserting. If you insert o\'mallies
into the database, the \ is only there to tell the database that the
following character is escaped. In this case, the ' is not the end of the
string, but something that should be included in the data that's put into
the database. The actual \ isn't put in the database.
So, with that said, you can fix your code and find out where you are
addslashes() twice. You can run some queries to replace \' in your database
with ', too.
Or you can just search for o\\\'mallies in your database, which will search
for a literal \ and a literal ' in the data.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php