MySQL Forums
Forum List  »  PHP

Re: Problemo with QUERY and LIMIT
Posted by: Travis Thomas
Date: April 07, 2006 06:20PM

I've tried that and it does display results... However it only displays 10 results...(I know that obviously makes sense...) I need to display all results, but limit them to 10 per page AFTER the initial query. Does that make sense?

Am I making this way too difficult?

This might also help...

This is the script I have to move between pages:

<?php

$categor = eregi_replace(' ','%20',$category);

echo ("<br />");

if ($s >= 1){
$prev=($s - $limit);
echo ("&nbsp;<a href=\"$PHP_SELF?category=$categor&s=$prev\">&lt;&lt; Prev 10</a>&nbsp;&nbsp;");
}
$pages = intval($numrows/$limit);

if ($numrows%$limit){
$pages++;
}
if (!((($s+$limit)/$limit) == $pages) && $pages!=1){
$next = $s+$limit;
echo ("&nbsp;<a href=\"$PHP_SELF?category=$categor&s=$next\">Next 10 &gt;&gt;</a>");
}
$a = $s + $limit ;
if ($a > $numrows){
$a = $numrows ;
}
$b = $s + 1 ;
echo ("<p>Showing products $b to $a of $numrows</p>");
?>

(I think) That's partly why I need to use " $query .=" LIMIT $s,$limit"; " in order for everything to work...

Options: ReplyQuote


Subject
Written By
Posted
Re: Problemo with QUERY and LIMIT
April 07, 2006 06:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.