note 17600 deleted from function.mysql-result by jimw

From: Date: Fri, 21 Dec 2001 00:29:29 +0000
Subject: note 17600 deleted from function.mysql-result by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23623@lists.php.net to get a copy of this message
Functions mysql_result and mysql_num_rows helps in situations when you need to cycle trough results several times (for example, in nested cycles). mysql_fetch_array in these situations works only for the first time. In example the external cycle is based on mysql_fetch_array (because every row is used only for one time), but internal cycle uses mysql_result and mysql_num_rows. while ($row = mysql_fetch_array($result_id_table1)) { $found = 0; for ($i=0, $n=mysql_num_rows($result_id_table2); $i<$n ; $i++) { $id2 = mysql_result($result_id_table2, $i, 0); if ($id2 == $row["id"]) { $found++; } } if ($found) { ... } } Ansis

« previous php.notes (#23623) next »