SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Each row needs to appear in a different page???

    Can someone please tell me how I can make each row in a table appear on different pages with the following code? The following code only make the first row appear. Thanks in advance.
    PHP Code:
    require "config.php";

    $page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
    $npp 1;

    if(
    $page 1$page 1;

    $sql "SELECT COUNT(*) FROM `articles`";
    $result mysql_query($sql) or die(mysql_error());
    $num mysql_result($result00);

    $num_pages ceil($num $npp);
    if(
    $page $num_pages$page $num_pages;

    $start = ($page 1) * $npp;

    $query "SELECT * FROM articles LIMIT $start$npp";
    $result mysql_query($query) or die(mysql_error());

    while(
    $row mysql_fetch_array($result)) {
        echo 
    $row['date_entered']. "<br />"$row['text'];
         echo 
    "<br />";
    }

    for(
    $i 1$i <= $pages$i++) {
        echo 
    '<a href="articles.php?page='$i .'">'$i .'</a>';
    }

    mysql_close(); 
    Last edited by cturner01; Jul 3, 2006 at 22:16.

  2. #2
    SitePoint Addict amitjoshi's Avatar
    Join Date
    Jul 2005
    Location
    Oklahoma, USA
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You seem to be doing everything right. How many tables do you actually have in your 'articles' table?

  3. #3
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Different PAGES? What do you really mean?
    Ian Anderson
    www.siteguru.co.uk


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
  •