Forgive me if I'm telling you something you already know.  It works like
this.  Somewhere in the screen, you something like the following:

define("HITS_PER_PAGE", 10);
if (!isset($resultsIndex))
{
        $resultsIndex = 0;
}
else
{
        $resultsIndex = intval($resultsIndex);
}

$query = "blah blah blah ";
$query .= "ORDER BY blah ";
$query .= "LIMIT $resultsIndex, " . ($resultsIndex + HITS_PER_PAGE);

//execute query to produce $records
$totalHits = mysql_numrows($records);
//output results

$prevIndex = $resultsIndex - HITS_PER_PAGE;
if ($prevIndex < 0)
   $prevIndex = 0;
$nextIndex = $resultsIndex + HITS_PER_PAGE;
if ($nextIndex > $totalHits)
   $nextIndex = $totalHits;

print("<BR>\n");
if ($resultsIndex > 0)
   print("<A HREF=\"" . ScreenURL("this_screen", FALSE, 
      array("resultIndex"=>$prevIndex)) . "\">Previous</A>");
if ($resultsIndex < $totalHits)
   print("<A HREF=\"" . ScreenURL("this_screen", FALSE,
      array("resultIndex"=>$nextIndex)) . "\">Next</A>");

That's the general idea, I'm sure it could be cleaned up just a bit.

Good luck,
-jj

> Yes im using it. At the first page it shows the right results, but when i press the 
>next
> button it pulls out all the Active items in the database.
> 
> > > Im making a new search result that uses the LIKE statement instead of eregi.
> > >
> > > Im a newbie with PHP, so im learning as i go with this project.
> > >
> > > The problem is i am trying to get the next/previous results right, but it seems 
>like the
> > > value of (inputKeywords) is gone when going to the next page. Im posting the 
>search value from a form, could any1 tell
> > > me what is happening.
> > Are you adding the $inputKeywords variable to the URL's for the next and
> > previous buttons via attaching it to the URL (see the ScreenURL
> > function)?

-- 
if (shannon - jj) * behrens == webEngineer["CLEAR INK�"]:
    print "<i>imagination is the only real medium(sm)</i><br>"


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to