Hi,
I have a search page which is stuctured as follows:
search.php - has the shell (header, leftnav, middlecontent, rightnav, footer) of the page. Within middleContent, I include:
searchA.php;
searchB.php;
searchC.php, each of which query the DB and return search results for a different category.
I haven't really tackled the issue properly yet, but I was wondering if anyone could suggest a good way of showing, say, 6 results from searchA.php on a page, then 6 more on the next etc, followed by 6 from searchB.php and so on.
Thanks for any help, and if you need further clarification, I can post some code.
M.
Show specified number of search results per page
Moderator: General Moderators
-
michealhealy
- Forum Newbie
- Posts: 1
- Joined: Fri Jun 24, 2005 9:43 am
Modify your SQL by adding following line,
As you may guess before doing that $currentPage is receieved from user.
If user havent posted yet, it is zero.
Code: Select all
<?php
$itemPerpage = 6;
$sql = "........LIMIT $currentPage, $itemPerpage";
?>If user havent posted yet, it is zero.
Here is one of them,
Code: Select all
if ($pageNo == "")
$pageNo = 0;
$sqlCount = "select * from gallery";
$resCount = mysql_query($sqlCount);
$itemCount = mysql_num_rows($resCount);
$pageCount = ceil($itemCount/10);
$sql = "select * from gallery order by MYID desc limit ".($pageNo*10).", 10";
$res = mysql_query($sql);
while ($info = mysql_fetch_array($res))
{
$items[count($items)] = $info;
}