One way would be to cycle through all your rows and have a counter figure out which row you are actually on.

PHP Code:
// assuming you are connected to your database
$query mysql_query("select id from table order by id");
for (
$i=0;$i<mysql_num_rows($query);$i++)
  if (
mysql_result($query,$i,"id") == 6)
    break;

echo 
$i