SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help organising my game script page

    Hi i have made a small flash arcade game script for my site.

    However at the moment it lists all games on 1 page, and i want it to only display 10 and have Page 1 of 32 - Next type of thing to organise it better and so that it loads quicker.

    Here is the current page, how would i be able to achive what i need?

    Thankyou for your time

    PHP Code:
       <?
                $qr1 
    mysql_query("SELECT * FROM cats WHERE status=1");
                while( 
    $row mysql_fetch_object($qr1) ){
    ?>
                    <div align="center" class="menuitem"><a class="menuitem" href="<?=$siteurl?>cats.php?id=<?=$row->id?>"><?=$row->name?></a></div>
    <?
                
    }
    ?>
    <br><br><br><br>
    <?
    $id 
    intval($_GET['id']);


        
    $qr1 mysql_query("SELECT * FROM cats WHERE id=$id");
        
    $cat mysql_fetch_object($qr1);
        
    $seo_title $sitename." - ".$cat->name." Games";

    ?>
        <h2 align="center"><?=$cat->name?> Games</h2>
    <?
            $qr1 
    mysql_query("SELECT * FROM games WHERE cat=$id AND status=1");
            while( 
    $row mysql_fetch_object($qr1) ){
    ?>
                <table width=100%>
                  <tr>
                    <td align=left width=25%>
                      <div align="center"><a href="<?=$siteurl?>games.php?id=<?=$row->id?>" class="nav"><img src="<?=$siteurl?>uploads/thumb/<?=$row->thumb?>" border=0  width="70" height="59"></a> </div>
                    </td>
                    <td align=left><div align=left>
                        <table width="98%" border="0">
                          <tr>
                            <td width="61%"><a href="<?=$siteurl?>games.php?id=<?=$row->id?>" class="nav">
                              <?=stripslashes($row->name)?>
                              </a><br>
                              <?=stripslashes($row->description)?>
                            </td>
                            <td width="39%">
                              <div align="center"><a href="<?=$siteurl?>games.php?id=<?=$row->id?>" ><img src="images/play.jpg"/></a></div>
                            </td>
                          </tr>
                        </table>
                        <br>
                      </div>
                    </td>
                  </tr>
                </table>
                <br>
    <?
            
    }
    ?>

  2. #2
    SitePoint Zealot trekmp's Avatar
    Join Date
    Dec 2005
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a good simple example, I used it in the past and had no problems

    http://www.plus2net.com/php_tutorial/php_paging.php
    Last edited by trekmp; Apr 27, 2006 at 08:06. Reason: missed a bit out
    Why do we exist? What is our purpose?
    >H2O Developments
    >USS Endeavour
    >Hosted@Servage

  3. #3
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhh brilliant mate, ill ive that a try.

    Cheers


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •