note 32615 deleted from function.mysql-fetch-array by philip

From: Date: Sun, 08 Aug 2004 16:45:03 +0000
Subject: note 32615 deleted from function.mysql-fetch-array by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74248@lists.php.net to get a copy of this message
Note Submitter: Talex@AT.freenet.am ---- 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.

« previous php.notes (#74248) next »