You should also add an ORDER BY clause in there, as the SQL standard doesn't
guarantee the order that rows are retrieved in. There's a chance that
you'll get, say, 20 rows on the first page, go to the second page and get
some of the rows you've already seen on the first page. If you use an ORD
Do a google search for ADODB. It's a PHP database abstraction layer. It has
built in 'pagination' methods (Previous X, next X) along with an example of
how to use them.
=C=
*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*
-Original Message-
From: Jason So
number of total rows, divide by 20, and
build a list of links in a for() loop.
$num_rows = mysql_num_rows($sql);
$num_pages = floor($num_rows/20);
for ($i=0; $i
To: "Kevin Stone" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, May 16, 2002 1:15 PM
Subject: Re: [PH
=red&i=25
Then have a $_GET['i'] variable in my script and set $i equal to that?
Your help is appreciated. Thanks again.
Jason Soza
- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
Date: Thursday, May 16, 2002 10:53 am
Subject: Re: [PHP] Making Mul
$query = "SELECT * FROM mytable LIMIT $i, 20";
Where 20 is the number of rows to retrieve and $i is the starting row.
By incrementing $i + 20 you can do next, prev buttons, or parse the total
number of rows into page links (prev - 1, 2, 3, 4, 5, 6.. 10.. 20 - next).
Search www.mysql.com for mor
5 matches
Mail list logo