note 26143 added to function.addslashes
| From: | Jean at rack1 dot php dot net | Date: | Sat, 19 Oct 2002 17:11:29 +0000 |
| Subject: | note 26143 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38297@lists.php.net to get a copy of this message | ||
if magic_quotes_gpc and magic_quotes_runtime are disabled you can use the function
mysql_escape_string() to resolve problems with the addslashes(). Ex:.
//Importing image to MySQL Database using addslashes
...
$data = addslashes(fread(fopen($form_data, "rb"), filesize($form_data)));
$result=MYSQL_QUERY("update produtos set image = '$data', image_type =
'$form_data_type' where prod_id = $regid",$db);
...
You can change addslashes() by mysql_escape_string to resolve the magic_quotes problem:
$data = mysql_escape_string(fread(fopen($form_data, "rb"), filesize($form_data)));
--
http://www.php.net/manual/en/function.addslashes.php
http://master.php.net/manage/user-notes.php?action=edit+26143
http://master.php.net/manage/user-notes.php?action=delete+26143
http://master.php.net/manage/user-notes.php?action=reject+26143