Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigation Between Result Pages

Status
Not open for further replies.

alsaffar

Programmer
Joined
Oct 25, 2001
Messages
165
Location
KW
Hi there,

Overview:
- I have a page that list my products (Products.php)
- I made that only 3 products can be displayed in a page at a time.
- There is "page number"s at the buttom of the products page (Like Yahoo Search Results) and every "page number" can be clicked to take you to another 3 products in a page.
- Each picture in the result page can be clicked to open a page (ProductDetails.php) that show the clicked picture details.

Problem:
Lets say we are in the result page number 5, and I clicked on one of the products picture in the result page number 5, then the ProductDetails.php opened with the details of the Product I clicked, NOW:

Question:
I want to go back to the result page number 5! HOW?

The following is some lines of my code, that may it help you to help me :)

$Query = " SELECT * FROM Products ORDER BY ProductID LIMIT $Offset, $ItemsPerPage ";
$y = 1;
for ($x=0; $x<$TotNumRows; $x+$ItemsPerPage)
{
echo &quot;[<a href=\&quot;/ProductDetails.php&Offset=$x&Page=$y\&quot;>$y</a>] &quot;;
$x = $x + $ItemsPerPage;
$y = $y + 1;
}

Please help
 
Oooooooo, I found it :)

I made $Offset = ($y*$ItemsPerPage)-$ItemsPerPage

Don't ask me how its worked with that formula, but ITS WORKING :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top