RE: Query Spans Multiple Pages

2002-10-09 Thread Luc Foisy

 -Original Message-
 From: William Martell [mailto:[EMAIL PROTECTED]]

 I am trying to query MySQL using PHP and I would like the 
 results to display
 on multiple pages.
 
 I would like to display only 20 results per page and allow 
 the user access
 to the other pages by clicking next or an index of numbers 1 
 2 3 4 5 6 and
 so on dependent upon the number of results returned.
 
 I do not know how to do this??  Can anyone point me in the right
 direction???


First you would probably query for the number of records that would be returned. That 
way you can create your navigation bar with the correct amount of increments (  1 2 
3 4 5 6  ). Each increment = 20 records.

Then you can perform queries using LIMIT ( LIMIT 0,19 ... LIMIT 20,39 ... LIMIT 40,59 
etc ).

 Also,  When a user does perform this query, will all of the 
 pages be created
 at that time. Or will the page be created with another 
 request and response
 from the server.

One page at a time using LIMIT.

You could create all the pages at once, but where are you going to put them, how are 
you going to serve them... I think you should just query each page of data when the 
user wants it.

 In other words.  Does the result of the query get stored in a 
 variable that
 is accessed on the client machine or does the php code return 
 the limit per

Hey look, you almost got a solution yourself...


Luc

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Query Spans Multiple Pages

2002-10-08 Thread Michael T. Babcock

William Martell wrote:

I do not know how to do this??  Can anyone point me in the right
direction???
  

Look up the LIMIT option in MySQL.

if (! $StartAt) {
$StartAt = 0;
}
... SELECT  LIMIT $StartAt, $PerPage;
$StartAt += $PerPage;

... then either session_register your startat variable or just pass it 
GET-style like search engines do.

-- 
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php