Display Records in Multiple Pages

2002-06-27 Thread Aqua

I have 100 records in mySQL database and I need to display them in my web
page using php and html. How to display them in multiple pages? Each page
must contain 25 records. Does anyone know how to do it other than create 4
pages and manually list the records there? or maybe point me some reference
please. Your help will be much appreciated. Thanks!

Aqua



-
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: Display Records in Multiple Pages

2002-06-27 Thread Alexander Barkov

You can use LIMIT clause:

SELECT fields FROM table LIMIT X,25

where X is number of row to start with.
You can substitute this number for example
in HREF:

A HREF=?X=25Page2/a
A HREF=?X=50Page3/a
A HREF=?X=75Page4/a

then your script should take X value and
use it to compose the query.


Aqua wrote:
 I have 100 records in mySQL database and I need to display them in my web
 page using php and html. How to display them in multiple pages? Each page
 must contain 25 records. Does anyone know how to do it other than create 4
 pages and manually list the records there? or maybe point me some reference
 please. Your help will be much appreciated. Thanks!
 
 Aqua
 
 
 
 -
 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
 
 
 



-- 
For technical support contracts, visit https://order.mysql.com/
__  ___ ___   __
   /  |/  /_ __/ __/ __ \/ /Mr. Alexander Barkov [EMAIL PROTECTED]
  / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Full-Time Developer
/_/  /_/\_, /___/\___\_\___/   Izhevsk, Russia
___/   www.mysql.com   +7-902-856-80-21


-
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




FW: Display Records in Multiple Pages

2002-06-27 Thread Bert VdB


Oops, forgot to send it to the list:



Use an index and offset in your queries.

You need 25 queries per page(=the offset), each page starting display from a
different record (=the index)
This would give something like this for page 1:
$result = mysql_query(SELECT * FROM your_table WHERE table_field =
'blahblah' ORDER BY table_field ASC LIMIT 0,25);
== this will result in records 1 to 24
For page 2, in one way or another, you just increase the index by 25,
resulting in
$result = mysql_query(SELECT * FROM your_table WHERE table_field =
'blahblah' ORDER BY table_field ASC LIMIT 25,25);
For page 3 :
$result = mysql_query(SELECT * FROM your_table WHERE table_field =
'blahblah' ORDER BY table_field ASC LIMIT 50,25);
Of course, you define the index as a php-variable and automatically increase
it every next page.

Hope it helps,
CB

-Original Message-
From: Aqua [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 07:55
To: [EMAIL PROTECTED]
Subject: Display Records in Multiple Pages


I have 100 records in mySQL database and I need to display them in my web
page using php and html. How to display them in multiple pages? Each page
must contain 25 records. Does anyone know how to do it other than create 4
pages and manually list the records there? or maybe point me some reference
please. Your help will be much appreciated. Thanks!

Aqua



-
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

-
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