prepare('SELECT COUNT(*) FROM City,Country WHERE City.CountryCode = Country.Code AND Country.Continent = :continent');
$stmt->execute( array(':continent'=>$_REQUEST['tb1']) );
$num_rows = $stmt->fetchColumn();
$stmt->closeCursor();
$pages = new Paginator($num_rows,9);
echo $pages->display_pages();
echo "".$pages->display_jump_menu().$pages->display_items_per_page()."";
$stmt = $conn->prepare('SELECT City.Name,City.Population,Country.Name,Country.Continent,Country.Region FROM City INNER JOIN Country ON City.CountryCode = Country.Code AND Country.Continent = :continent ORDER BY City.Name ASC LIMIT :start,:end');
$stmt->bindParam(':start', $pages->limit_start, PDO::PARAM_INT);
$stmt->bindParam(':end', $pages->limit_end, PDO::PARAM_INT);
$stmt->bindParam(':continent', $_REQUEST['tb1'], PDO::PARAM_STR);
$stmt->execute();
$result = $stmt->fetchAll();
echo "City | Population | Country | Continent | Region |
\n";
foreach($result as $row) {
echo "$row[0] | $row[1] | $row[2] | $row[3] | $row[4] |
\n";
}
echo "
\n";
echo $pages->display_pages();
echo "Page: $pages->current_page of $pages->num_pages
\n";
echo "SELECT * FROM table LIMIT $pages->limit_start,$pages->limit_end (retrieve records $pages->limit_start-".($pages->limit_start+$pages->limit_end)." from table - $pages->total_items item total / $pages->items_per_page items per page)";
}
?>