RE: [PHP-DB] mysql_fetch_array()

From: Date: Fri, 18 Aug 2000 13:40:16 +0000
Subject: RE: [PHP-DB] mysql_fetch_array()
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2159@lists.php.net to get a copy of this message
If your goal with using a count was to obtain the number of rows returned from your query, use this instead: $numrows = mysql_num_rows($proved) ; http://www.php.net/manual/function.mysql-fetch-array.php http://www.php.net/manual/function.mysql-num-rows.php HTH Sam Masiello System Analyst Chek.Com (716) 853-1362 x289 smasiello@chekinc.com -----Original Message----- From: Libor Matyáš [mailto:matyasl@vscht.cz] Sent: Friday, August 18, 2000 9:27 AM To: php-db@lists.php.net Subject: [PHP-DB] mysql_fetch_array() Hello, this is the code i used: $spojeni=mysql_connect("****","***","***"); if (!spojeni) { break; } mysql_select_db("***", $spojeni); $proved=mysql_query("select * from tb_main",$spojeni); while ($zaznam=mysql_fetch_array($proved)) { $pocet=count($zaznam); for($x=0; $x<$pocet; $x++) { echo $zaznam[$x]."\n"; echo "<br>*****<br>"; } echo $pocet; } the table's got 5 fields, why does $pocet=10? it's always double the number of fields the table has. with ..fetch_row... one gets the right number. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#2159) next »