Re: [PHP-GENERAL] Apostrophes/SQL Statements
[email protected] (Jan Dvorak)
| Newsgroups | php.general |
|---|---|
| Organization | MathAn Praha, Ltd. |
| Message-ID | <[email protected]> |
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