Help With Paging Mysql Results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonnyw6969
Forum Newbie
Posts: 5
Joined: Sat Aug 12, 2006 9:31 am

Help With Paging Mysql Results

Post by jonnyw6969 »

Hi,

Could someone please help me with my problem? Im trying to page the results from my database to 10 per page and links to further pages at the bottom of the results, similar to what google or any search engine does. ive looked at loads of pieces of code but im still no closer to getting right.

This is the section of my results page i need help with.

Code: Select all

<table width="90%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CACACA" background="images/topnav_bg_green.gif"> 
      <tr> 
        <td width="90"><div align="left">Our Team</div></td> 
        <td width="148"><div align="left">Opposition </div></td> 
        <td width="76"><div align="left">Date</div></td> 
        <td width="55"><div align="left">H/W </div></td> 
        <td width="68"><div align="left">Competition </div></td> 
        <td width="106"><div align="left">Venue </div></td> 
      </tr> 
    </table> 
    <br /> 
     
<br /> 
     
    <table width="90%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CACACA"> 
     <?php 
        $sql = "SELECT * FROM fixres WHERE frstatus='fixture' ORDER By datecc"; 
        if ($result = mysql_query($sql)) { 
            ?><?php 

            while($row = mysql_fetch_array($result)) { 

            ?> 
       
      <tr> 
        <td width="90"><div align="left"><?php echo $row['team']; ?>'s</div></td> 
        <td width="148"><div align="left"><?php echo $row['opposition']; ?> </div></td> 
        <td width="76"><div align="left"><?php echo $row['datecc']; ?></div></td> 
        <td width="55"><div align="left"><?php echo $row['home_away']; ?></div></td> 
        <td width="68"><div align="left"><?php echo $row['competition']; ?> </div></td> 
        <td width="106"><div align="left"><?php echo $row['venue']; ?> </div></td> 
      </tr> 
       
    </table> 
    <br /><table width="90%"  border="0" cellspacing="0" cellpadding="0"> 
  <tr><? }} ?> 
    <td align="center" height="20"></td> 
  </tr> 
</table>
Hope someone can help.
Cheers guys
Jon
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

. < click the dot
jonnyw6969
Forum Newbie
Posts: 5
Joined: Sat Aug 12, 2006 9:31 am

many thanks. works great now

Post by jonnyw6969 »

many thanks. works great now

cheers
Jon
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

WOW!

<sarc>
I'm amazed that the problem was solved by a simple little dot... how amazing!
</sarc>
Post Reply