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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to