Advertisement
Guest User

last

a guest
Nov 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <?php for( $i = 0; $i < count( $results-
  2. >data ); $i++ ) : ?>
  3.         <tr>
  4.                 <td><?php echo $results-
  5. >data[$i]['Name']; ?></td>
  6.                 <td><?php echo $results-
  7. >data[$i]['Country']; ?></td>
  8.                 <td><?php echo $results-
  9. >data[$i]['Continent']; ?></td>
  10.                 <td><?php echo $results-
  11. >data[$i]['Region']; ?></td>
  12.         </tr>
  13. <?php endfor; ?>
  14. Now for make use of our Paginator
  15. class add the following php code at the
  16. top of the document.
  17. <?php
  18.     require_once 'Paginator.class.php';
  19.     $conn       = new mysqli( '127.0.0.1',
  20. 'root', 'root', 'world' );
  21.     $limit      = ( isset( $_GET['limit'] ) ) ?
  22. $_GET['limit'] : 25;
  23.     $page       = ( isset( $_GET['page'] ) )
  24. ? $_GET['page'] : 1;
  25.     $links      = ( isset( $_GET['links'] ) ) ?
  26. $_GET['links'] : 7;
  27.     $query      = "SELECT City.Name,
  28. City.CountryCode, Country.Code,
  29. Country.Name AS Country,
  30. Country.Continent, Country.Region
  31. FROM City, Country WHERE
  32. City.CountryCode = Country.Code";
  33.     $Paginator  = new Paginator( $conn,
  34. $query );
  35.     $results    = $Paginator->getData( $
  36. page, $limit );
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement