note 32615 added to function.mysql-fetch-array

From: Date: Tue, 03 Jun 2003 06:26:23 +0000
Subject: note 32615 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-49597@lists.php.net to get a copy of this message
Here i've found lot of notes about mysql_fetch_array() function, but i've not found nothing about number of elements which this function returns. I'd a problem with that. so... // for example number of elements in database is 10. //snatch of code: $list = mysql_fetch_array($result, MYSQL_BOTH); //or $list = mysql_fetch_array($result); print("Number of elements is - \n".count($list)); //the output Number of elements is - 20 BUT, if we'll do this way $list = mysql_fetch_array($result, MYSQL_ASSOC); //or $list = mysql_fetch_array($result, MYSQL_NUM); print("Number of elements is - \n".count($list)); //the output Number of elements is - 10 As u can see this function uses twice more space when using MYSQL_BOTH, then in another cases. One note too. If u'll try to print out the results this way or any other - print("<tr>"); foreach($list as $myrow) { print("<tr>"); print("<td>$myrow</td>\n"); print("</tr>"); } print("</tr>"); u'll see that somethig like this - //output 1 1 Bob Bob Smith Smith 128 Here St, Cityname 128 Here St, Cityname Marketing Manager Marketing Manager //not this way 1 Bob Smith 128 Here St, Cityname Marketing Manager 1 Bob Smith 128 Here St, Cityname Marketing Manager i.e. the same row comes after each other. ______ hope it'll help You All in process of development. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32615 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32615&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32615&report=yes

« previous php.notes (#49597) next »