Re: Apostrophes/SQL Statements
| From: | Jan Dvorak | Date: | Mon, 15 May 2000 09:36:53 +0000 |
| Subject: | Re: Apostrophes/SQL Statements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55@lists.php.net to get a copy of this message | ||
Emile Axelrad wrote:
>
> I'm getting problems with my SQL Statements where the data has apostrophes
> [single quotes]. It messes up the insertion procedure - what should I do?
> How do I get rid of the single quotes from a string?
Use AddSlashes() in your data insertion scripts.
As for the already inserted data,
you can do use the following procedure:
select trim( both "'" from yourstringfield ) from yourtable;
If the output looks like what you want,
do an:
update yourtable
set yourstringfield = trim( both "'" from yourstringfield );
This is pretty much standard SQL,
so any DBMS that is worth the name should carry it out for you.
Jan