Panjabel Posted July 14, 2007 Share Posted July 14, 2007 it is posible to get the result row number in php from mysql ? thanks Quote Link to comment Share on other sites More sharing options...
Panjabel Posted July 14, 2007 Author Share Posted July 14, 2007 up Quote Link to comment Share on other sites More sharing options...
keeB Posted July 14, 2007 Share Posted July 14, 2007 Sure... Say, for example, your query engine looks something like this: <?php $new = array(); while ($row = mysql_fetch_array($result)) { array_push($row, $new); } for($i=0, $i<count($new); $i++) { print "iterating through result: " . $i . "<br> contains " . $new[$i] . "<br>"; } ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 14, 2007 Share Posted July 14, 2007 If the table you are querying contains an id column. include the id column in your query, eg: <?php $sql = "SELECT id, another_column, col_x FROM tbl_name_here"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { echo $row['id'] . ' - ' . $row['another_column'] . ' - ' . $row['col_x'] . '<br>'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.