[B]Simple guest book[/B]

Discussion in 'PHP' started by kudzo, Jul 7, 2009.

  1. #1
    Hi,
    First: sorry my English
    Second: I have a problem with this PHP code. Everything work perfect, but change to another page doesn’t work. I call 10 contributions to display on single page. I gat more then 30 contributions in database so I see last 10 and on the bottom link to another pages. My problem: if I clicked on the page 2 or 3 or … I always see just last 10 contributions.



    <?php
    echo "<h2>Guest book </h2>";
    echo "<a href='?id=333' title=''>new</a> <br /> <br />";
    if (!isSet($page)) $page=1;
    include("function.php"); // for conection with database
    connect();
    $result=mysql_query("select * from book order by id DESC");
    $pocet=mysql_num_rows($result);
    if ($pocet%10!=0) {$stran=floor($pocet / 10)+1;} else {$stran=floor($pocet / 10);}
    for ($i=0;$i<$pocet;$i++) {
    if ($i >= (($page-1)*10) && ($i < $page*10))
    {
    $name=mysql_result($result,$i,'name');
    $date=mysql_result($result,$i,'date');
    $text=mysql_result($result,$i,'text');
    
    echo "<center><b>$name</b> $date<br />";
    echo "$text<br />";
    echo "<hr /><br />";
    }
    }
    echo "Page: "; 
    for ($i=1;$i<=$stran;$i++) { 
    echo "<a class='odkaz' href='?id=333?page=$i'> $i </a>";
    }
    ?>
    PHP:
    Thank for all guidance..
     
    kudzo, Jul 7, 2009 IP
  2. anthonywebs

    anthonywebs Banned

    Messages:
    657
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what is it supposed to do?

    ps
    HAHAHAHA TRYING TO MAKE THE TITLE BOLD!!! HAHAHAHAHAHA
     
    anthonywebs, Jul 8, 2009 IP
    kudzo likes this.
  3. kudzo

    kudzo Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you don’t have what to say …. Be quiet.
     
    kudzo, Jul 8, 2009 IP