Help with Pagination

Links for php scripts

Moderators: macek, egami, gesf

Post Reply
FishBird
New php-forum User
New php-forum User
Posts: 21
Joined: Thu Apr 12, 2012 8:05 am
Contact:

Re: Help with Pagination

Post by FishBird » Thu Apr 12, 2012 9:19 am

Allright, a very dirty solution is this:

Code: Select all

$page = (int) $_GET['page'];
$stopBy = $page*5;
$startBy = $stopBy - 5;
$startBy<0? $startBy = 0:"";
$i = 0;
$query = "SELECT model, colour, registration, price, mot, make, origcountry FROM joinedresults LIMIT ".$startBy.",5 ";

$result = mysqli_query ($connection, $query);
while ($row = mysqli_fetch_row($result) ) 
{
   
    $carsFound = true;
    $sourceForTable .= "<tr>";
    for ($i = 0; $i < mysqli_num_fields($result); $i++)
        $sourceForTable .= "<td>$row[$i]</td>";
    $sourceForTable .= "</tr>\n";

}
mysqli_close($connection);



Did not test it,but should work. Have fun :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest