note 26143 deleted from function.addslashes by philip
| From: | philip@php.net | Date: | Tue, 20 Jul 2004 17:18:43 +0000 |
| Subject: | note 26143 deleted from function.addslashes by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73712@lists.php.net to get a copy of this message | ||
Note Submitter: Jean Paul
----
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)));