Mixing sprintf and mysql_real_escape_string
| From: | Peter Lauri | Date: | Mon, 07 Aug 2006 17:35:20 +0000 |
| Subject: | Mixing sprintf and mysql_real_escape_string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-240291@lists.php.net to get a copy of this message | ||
Hi,
I get strange output if I combine sprintf and mysql_real_escape_string. If I
do this the resulting into the database is \' not ' as I want.
mysql_query(sprintf("INSERT INTO table (value1, value2) VALUES (1, '%s')",
mysql_real_escape_string(" ' ")));
Should this be like this? Do the sprintf already add slashes or something?
/Peter