note 72190 added to function.mysql-num-rows

From: Date: Sun, 07 Jan 2007 02:24:57 +0000
Subject: note 72190 added to function.mysql-num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-121367@lists.php.net to get a copy of this message
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; } ---- Server IP: 64.71.164.2 Probable Submitter: 68.102.209.50 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-num-rows.php Edit -- https://master.php.net/note/edit/72190 Del: integrated -- https://master.php.net/note/delete/72190/integrated Del: useless -- https://master.php.net/note/delete/72190/useless Del: bad code -- https://master.php.net/note/delete/72190/bad+code Del: spam -- https://master.php.net/note/delete/72190/spam Del: non-english -- https://master.php.net/note/delete/72190/non-english Del: in docs -- https://master.php.net/note/delete/72190/in+docs Del: other reasons-- https://master.php.net/note/delete/72190 Reject -- https://master.php.net/note/reject/72190 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121367) next »