note 72190 deleted from function.mysql-num-rows by nlopess
| From: | nlopess@php.net | Date: | Sun, 07 Jan 2007 14:08:06 +0000 |
| Subject: | note 72190 deleted from function.mysql-num-rows by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121379@lists.php.net to get a copy of this message | ||
Note Submitter: kevin at bionichippo dot com
----
I searched and searched and found no way of getting the number of the current result in a query, so
i wrote my own function for it. It turned out to be relatively easy and very useful. $query is the
query you want the row from, and $check_id is the id of the row you want numbered.
function get_row($query,$check_id){
for($i = 0; $i < mysql_num_rows($query); $i++){
if(mysql_result($query, $i) === $check_id)
$n = $i;
}
return $n;
}