Php expert visit here
Started on the old forum in October 2011 · view the original in the archive · old links redirect here
$jid = mysql_fetch_array(mysql_query("SELECT id FROM table WHERE name='jesus'"));
echo 'Jesus is on page '.ceil($jid[0]/2);
if you know there is going to be some rows deleted from your database..... eg: say joe and san was deleted then you would need to do something like this:
$jid = mysql_fetch_array(mysql_query("SELECT id FROM table WHERE name='jesus'"));
$nor = mysql_num_rows(mysql_query("SELECT * FROM table WHERE id<'".$jid[0]."'"));
echo 'Jesus is on page '.ceil($nor/2);
or you could use something like this:
$nor = mysql_num_rows(mysql_query("SELECT * FROM table WHERE name BETWEEN '' AND 'jesus'"));
echo 'Jesus is on page '.ceil($nor/2);
but you would have to go a little careful with it as BETWEEN will include the result jesus on some databases and not on others. if it doesnt include it you would need to add 1 to $nor