note 41002 added to function.mysql-data-seek
| From: | kennethnash1134 at yahoo dot com | Date: | Fri, 26 Mar 2004 05:12:05 +0000 |
| Subject: | note 41002 added to function.mysql-data-seek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67186@lists.php.net to get a copy of this message | ||
/*here is a nice function for converting a mysql result row set into a 2d array, a time saver if
need small data from several rows, saves you from having to do Alot of queries... would be nice to
have this built into PHP future versions :) */
// simple example query
$r=mysql_query("select user,id,ip from accounts limit 10");
//starts the for loop, using mysql_num_rows() to count total
//amount of rows returned by $r
for($i=0; $i<mysql_num_rows($r); $i++){
//advances the row in the mysql resource $r
mysql_data_seek($r,$i);
//assigns the array keys, $users[row][field]
$users[$i]=mysql_fetch_row($r);
}
//simple, hope someone can use it :)
// -Kenneth Nash
----
Manual Page -- http://www.php.net/manual/en/function.mysql-data-seek.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41002
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41002&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41002&report=yes
Search -- http://master.php.net/manage/user-notes.php