note 40921 added to function.mysql-fetch-array
| From: | arjini at mac dot com | Date: | Fri, 19 Mar 2004 05:08:59 +0000 |
| Subject: | note 40921 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67046@lists.php.net to get a copy of this message | ||
When designing any script that is going to be doing big queries, be aware that with large amounts of
data, this will cause headaches:
$query_result = mysql_query('sql statement');
for($i=0;$row=mysql_fetch_assoc($query_result);++$i)
$results[$i] = $row;
or something similar. If you pass $query_result around, you're just passing the resource, and
not the information itself. If one passes around $results with 10,000 items, you'll quickly be
out of memory.
Of course with tiny queries, it can be perfect (getting a user's info, or a single row out of
the db).
For generating HTML tables of query results, or dealing with massive data sets, I highly recommend
Vincent Oostindië's eclipse library:
http://www.students.cs.uu.nl/
people/voostind/eclipse/
index.php?page=download
Check out the QueryIterator and pagedQuery modules, you'll love them.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40921
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40921&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40921&report=yes
Search -- http://master.php.net/manage/user-notes.php