php - Mysql Multiplication error -
i have code below , using mysql loop rows of database. $pages == 1
pages on /list.php?page=1 problem else section. if go page 2 both $pages2
& $pages3
echo out 40 & 80 mysql loop still get's results 41-120 out of database, why? want row 40 80 in output, nothing more.
if($pages == 1) { $pages3 = 40; $pages2 = 0; echo $pages2; echo $pages3; } else { $pages3 = 40 * $pages; $pages2 = 40 * $pages - 40; echo $pages2; echo $pages3; } $currentpage = 0; $sql = "select * cake"; $numrows = mysql_num_rows(mysql_query($sql)); $getquery = mysql_query("$sql order id limit $pages2, $pages3"); while($rows=mysql_fetch_assoc($getquery)){
on limit first parameter first row start (starting 0) , second amount of rows fetched.
so should like:
$getquery = mysql_query("$sql order id limit $pages2, 40");
Comments
Post a Comment