Re: addslashes/stripslashes
| From: | Paul Dionne | Date: | Wed, 06 Nov 2002 12:42:29 +0000 |
| Subject: | Re: addslashes/stripslashes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122976@lists.php.net to get a copy of this message | ||
thanks guys, got it working now. Removed Addslashes and it works fine.
1lt John W. Holmes wrote:
>> 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
> a
>> 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.
>
> ---John Holmes...