Re: Automatically Escape?
| From: | Matthew Weier O'Phinney | Date: | Tue, 16 Nov 2004 13:09:59 +0000 |
| Subject: | Re: Automatically Escape? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202133@lists.php.net to get a copy of this message | ||
* Gh <garyhotko@gmail.com>:
> Is there a function that can automatically escape special characters
> before putting them into mySQL?
Use PEAR's DB or MDB2 libraries with prepared statements and
placeholders:
$sql = "INSERT INTO someTable(value1, value2) VALUES(?, ?)";
$ins = $db->query($sql, array($value1, $value2));
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org