Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Displaying database query over multiple pages
Old 12-19-2007, 04:12 PM Displaying database query over multiple pages
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Hey guys. I am trying to select a whole bunch of rows from a database and then have only 30 output per page. I was thinking of just putting an IF statement within while($row = mysql_fetch_array($result)) and then have an incrementing variable and stop outputting when its >30, but i know thats not very efficient as the server is still oputting everything.

What would be a better way?
Truly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2007, 04:30 PM Re: Displaying database query over multiple pages
Novice Talker

Posts: 13
Name: hach22
Trades: 0
Hi, read this...
http://www.php-mysql-tutorial.com/php-mysql-paging.php
hach22 is offline
Reply With Quote
View Public Profile
 
Old 12-19-2007, 11:07 PM Re: Displaying database query over multiple pages
smo
smo's Avatar
Skilled Talker

Posts: 94
Location: India
Trades: 0
You have to use limit command in your query to restrict the output. You can keep the number of records per page in a variable and ask the visitors to select that value, so they can select 10 records per page or 20 records per page or more.

All these techniques are used in php paging script here. You can see advanced version of the script where pages broken in groups.
__________________

Please login or register to view this content. Registration is FREE
:
Please login or register to view this content. Registration is FREE
:
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
:
Please login or register to view this content. Registration is FREE
smo is offline
Reply With Quote
View Public Profile Visit smo's homepage!
 
Old 12-23-2007, 03:37 AM Re: Displaying database query over multiple pages
Junior Talker

Posts: 4
Name: michael oyeyinka
Trades: 0
You don't need to insert your code in multiple page , all you have to do is to use paging, so that all your information are displayed on the same page but only a chosen length , which we be replaced by another set each time the page load load.
jahtex2000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Displaying database query over multiple pages
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.62800 seconds with 12 queries