php - Limit the number of rows returned - mysql -


i'm trying limit number of rows returned query. code i'm using.

$min = ($id2-1)*16; $max = $id2*16;  $row = mysql_query("select * anunt masina = 2 order anuntid desc limit $min, $max") or die(mysql_error()); 

id2 value parsed link. when id2 2 example, query should have limit 16 32 - total of 16 entries. problem query returning me 32 entries. it's it's jumping on '$min' value. quad checked , in end, query seems problem.

any ideas? thanks

replace this:

$row = mysql_query("select * anunt masina = 2 order anuntid desc limit $min, $max") or die(mysql_error()); 

by this:

$records = $max - $min; $row = mysql_query("select * anunt masina = 2 order anuntid desc limit $records, $min") or die(mysql_error()); 

Comments