PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old October 21st, 2003, 05:39 PM
lobos34 lobos34 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: San Francisco
Posts: 17 lobos34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP results on seperate pages

Hey all

I have a couple of questions for you guys.
1. I have this code for pulling results from a mysql table
PHP Code:
<?php
 
} else {
       
$result mysql_query("SELECT * FROM reviews ORDER BY title ASC",$db); 
    
$COLUMNS = (int) 4
    
$i = (int) 0
    while (
$myrow mysql_fetch_array($result)) { 
        if(
$i++ == 0
{
            
printf("<tr>"); 
        } 
        
printf("<td align=center ><a href=\"%s?id=%s\">%s<br>%s</a></td>"
$PHP_SELF$myrow["id"], $myrow["title"], $myrow["company"]); 
if(
$i == $COLUMNS) { 
            
printf("</tr>"); 
            
$i 0;         } 
    } 
      if(
$i 0) { 
        while(
$i++ != $COLUMNS) { 
            
printf("<td>&nbsp;</td>"); 
        } 
        
printf("</tr>"); 
        }
}
?>


this code pulls the results from the table and lays them out in 4 columns across and continues down until it runs out of results.
What I would like it to do is lay them out 4 columns across and 10
rows down. Then continue on the next page.
I have been trying to find a tutorial, with no luck! Can anyone help with this?

2. Can I use this code and just add the code to continue to the next page or do I have to rewrite it?

Thanks.

Reply With Quote
  #2  
Old October 22nd, 2003, 11:29 AM
lobos34 lobos34 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: San Francisco
Posts: 17 lobos34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have posted this question on 3 boards and no one is answering it....
Am I missing something, or have I asked the wrong question?

Reply With Quote
  #3  
Old October 22nd, 2003, 02:22 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Do a search for "paging" or "pagination." There's a tutorial within the articles of this site, I believe, and I'm pretty sure I've seen someone else pose the same question in the forums very recently. It's a fairly common question, and it probably gets few replies because it's considered common courtesy for people to look around before asking questions.

Basically, you'll want to add a limit to your query, keep track of the last starting point, and begin the subsequent page's limit at that starting point.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP results on seperate pages


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway