note 44980 added to function.chunk-split
| From: | Craig at chatspike dot net | Date: | Sun, 22 Aug 2004 03:59:12 +0000 |
| Subject: | note 44980 added to function.chunk-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75082@lists.php.net to get a copy of this message | ||
This function is great if you plan on doing large MySQL inserts with a small buffer size, i wont
include a sample script, but i'll explain how it would work..
You take your large file.. chunk_split it (Ensuring that you use the right data size), with a char
which WONT appear in the file (your might wanna base64_encode the file first..(will also cut down on
'addslashes' problems)), once this is done, you can explode() the data, based on your
seperation char, create an empty record in the MySQL database, get the id of it using
mysql_insert_id(), then create a for loop which performs something like "UPDATE files SET
contents = concat('$buffer') WHERE id = '$blah';" on each of the segments..
Hope this is understandable, and helps people out.
----
Manual Page -- http://www.php.net/manual/en/function.chunk-split.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44980
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44980&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44980&report=yes
Search -- http://master.php.net/manage/user-notes.php