note 79416 added to function.bin2hex
| From: | kissifrot at gmail dot com | Date: | Mon, 26 Nov 2007 10:38:53 +0000 |
| Subject: | note 79416 added to function.bin2hex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132571@lists.php.net to get a copy of this message | ||
bin2hex can be useful to insert data into BLOB binary fields.
for example if you want to insert the content of a file :
<?php
$filename = '/foo/bar';
$bin_content = fread(fopen($filename,"r"),filesize($filename));
// use the usual mysql_connect() function
$insert_query = "INSERT INTO mytable (blob_field) VALUES
('".bin2hex($bin_content)."')";
mysql_query($insert_query);
?>
----
Server IP: 195.221.21.36
Probable Submitter: 82.123.174.53
----
Manual Page -- http://www.php.net/manual/en/function.bin2hex.php
Edit -- https://master.php.net/note/edit/79416
Del: integrated -- https://master.php.net/note/delete/79416/integrated
Del: useless -- https://master.php.net/note/delete/79416/useless
Del: bad code -- https://master.php.net/note/delete/79416/bad+code
Del: spam -- https://master.php.net/note/delete/79416/spam
Del: non-english -- https://master.php.net/note/delete/79416/non-english
Del: in docs -- https://master.php.net/note/delete/79416/in+docs
Del: other reasons-- https://master.php.net/note/delete/79416
Reject -- https://master.php.net/note/reject/79416
Search -- https://master.php.net/manage/user-notes.php