RE: [PHP-DB] Inserting a ' into mySQL
| From: | Ford, Mike [LSS] | Date: | Sat, 21 Aug 2004 01:23:05 +0000 |
| Subject: | RE: [PHP-DB] Inserting a ' into mySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35828@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Ron Piggott
> Sent: 21/08/04 01:53
[....]
> One of the problems I am now having is if the user types an ' into their
> entry --- these ones do not get saved into the mySQL database.
[....]
> I can look at this and understand that if an ' is keyed why it wouldn't save
> and that line would create an error --- How do you work around this?
That's what mysql_real_escape_string() is for -- http://www.php.net/mysql_real_escape_string.
Cheers!
Mike