SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2001
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I have been reading all the posts and trying to learn as much as possible. I think I'm starting to figure this PHP stuff out a little. I have a question though, I want to show only 10 results per page, and have the user clicknext to view the next 10 and so on. I am pretty lost, I would really appreciate some help. Here is my code so far.

    Code:
    <html>
                       <head>
                       <style type="text/css">
                       body {font-family:verdana,arial; font-size:10pt}
                       TD {font-family:verdana,arial; font-size:10pt}
                       #header {color:white; font-weight:bold; font-family:verdana,arial}
                       A {color:navy; text-decoration:underline}
                       A:hover {color:red}
                       A:visit {color:navy}
                       </style>
                       </head>
    
                       <body>
                       <table border=0 bgcolor=black width=650 cellpadding=0 cellspacing=0>
                       <tr><td>
                       <table border=0 cellpadding=2 cellspacing=1 width=100%>
                       <tr bgcolor=navy>
                       <td  align=middle id="header">NAME</td>
    									 <td  align=middle id="header">ID</td>
                       <td align=middle id="header">PRICE</td>
    									<td  align=middle id="header">PEOPLE</td>
                       <td  align=middle id="header">GAMES</td>
    <td  align=middle id="header">DESCRIPTION</td>
    <td  align=middle id="header">RATING</td>
    
                       </tr>
                       <?php
                       require("mydb.inc");
                       mysql_connect(localhost,$user,$password);
    
                       $database="*********";
                       @mysql_select_db("$database") or die( "Unable to select database"); 
    
                       /*Search database */
                       $table="things";
    									 
                       $query="select * from $table group by id";
    
                       $result=mysql_query($query);
    
                                          mysql_close();
    
                       /*Display Results*/
    
                       $num=mysql_numrows($result);
    
                       $i=0;
                       while ($i < $num) {
    
    
    $id=mysql_result($result,$i,"id");
    $name=mysql_result($result,$i,"name");
    $url=mysql_result($result,$i,"url");
    $price=mysql_result($result,$i,"price");
    $storage=mysql_result($result,$i,"people");
    $pop3=mysql_result($result,$i,"games");
    $description=mysql_result($result,$i,"description");
    $rating=mysql_result($result,$i,"rating");
    
    
                           print ($i % 2) ? "<tr bgcolor=\"D7DEFF\">" : "<tr bgcolor=\"C2CCFF\">";
    
                           echo "<td align=middle><A HREF=\"$url\" target=\"_blank\"><B>$name</B></A></td>";
    print "<td align=middle><b>$id</b></td><td align=middle><b>$price</b></td>";
    print "<td align=middle><b>$people</b></td><td align=middle><b>$games</b></td>";
    print "<td align=middle><b>$description</b></td><td align=middle><b>$rating</b></td>";
    
    
                           ++$i;
                       }
    									 
    
                                                     ?>
    
                       </table>
                       </td></tr>
                       </table>
                       
                       <a href='addinfo.php'><b>Data Entry page</b></a>
    
                         </body>
    </html>

    Thank you for the help in advance.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out this post it should cover what Y ouwant to do.
    http://www.sitepointforums.com/showt...threadid=19364
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •