Ben Dorin
Ben Dorin

Reputation: 1

show all users from table by pagination

i got large amount of users into my table and i want to made an small script to show all users as 10 per page

I'm using this script http://www.phpeasystep.com/phptu/29.html but its showing only 1 result per page. As they are saying on pic 7 i loop the code to show the users as this :

    $id = $row["id"];
    $username = $row['username'];
    $date = $row['date']; 

And its echo-ed as this:

    <?php

    echo '<div class="content">
    <h1><a href="edit.php?user=' . $id . '"> ' . $username . ' </a></h1>
    <div class="content_item">
    <p>'.$date.'</p>
    </div>
    </div>';

?>

However i dont understand why its showing only 1 result per page! I setted $start as 0 and $limit as 10

Upvotes: 0

Views: 189

Answers (1)

prakhar19
prakhar19

Reputation: 463

You have to place this echo code in a Loop, which would echo the Details of Users repeatedly.

For Example-

foreach($results as $r)
{
    echo $r->id;
    echo $r->username;
}

Upvotes: 1

Related Questions