note 55686 deleted from function.addslashes by nlopess
| From: | nlopess@php.net | Date: | Sat, 24 Sep 2005 07:49:45 +0000 |
| Subject: | note 55686 deleted from function.addslashes by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95683@lists.php.net to get a copy of this message | ||
Note Submitter: Ricardo Obregón <dmsupport at walla dot com>
----
I prefer a command like this for dumping a binary content into a valid mysql insert command.
<?php
$SrcPathFile = 'mybinfile.dat';
$bindata = '0x'.bin2hex(fread(fopen($SrcPathFile, "rb"),
filesize($SrcPathFile)));
$writestring .= "$field=$bindata"; // Note that there is no quotes (e.g.
myfield=0x00abdf3...)
?>
This is a safe data insertion.