Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. class WorldMapper extends Mapper{
  3. public function getCountries(){
  4. $sql = "SELECT Name, Continent, Region from country";
  5. $stmt = $this->db->query($sql);
  6. $results = [];
  7. while($row = $stmt->fetch()) {
  8. $results[] = array_map('utf8_encode', $row);
  9. }
  10. return $results;
  11. }
  12.  
  13. public function getCountriesPaging($starts_record, $records_per_page){
  14. $sql = "SELECT Name, Continent, Region from country limit ".$starts_record.", ".$records_per_page;
  15. $stmt = $this->db->query($sql);
  16. $results = [];
  17. while($row = $stmt->fetch()) {
  18. $results[] = array_map('utf8_encode', $row);
  19. }
  20. return $results;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement