Advertisement
Guest User

Untitled

a guest
Feb 5th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. $targetpage = "offer.php";
  4. $limit = 20;
  5. $sql1 = $db->prepare("SELECT * FROM classified WHERE type ='1' ORDER BY date DESC");
  6. /*** fetch Number of results ***/
  7. $total_pages =$sql1->rowCount();
  8. $stages = 3;
  9. $page = ($_GET['page']);
  10. if($page){
  11. $start = ($page - 1) * $limit;
  12. }else{
  13. $start = 0;
  14. }
  15. $sql = $db->prepare("SELECT * FROM classified WHERE type = '1' ORDER BY date DESC LIMIT $start,
  16. $limit ")or die(print_r($sql->errorInfo(), true));
  17. $sql->execute();
  18. $result = $sql->fetchAll();
  19. //Include pagination
  20. require_once("pagination.php");
  21. // pagination
  22. echo $paginate;
  23. foreach($result as $row){
  24. $id = htmlentities($row['id'], ENT_QUOTES);
  25. $id_city = htmlentities($row['id_city'], ENT_QUOTES);
  26. $title = htmlentities($row['title'], ENT_QUOTES ,'utf-8');
  27. $querya = $db->prepare("SELECT * FROM city WHERE id = :id_city");
  28. /*** bind the paramaters ***/
  29. $querya->bindParam(':id_city', $id_city, PDO::PARAM_INT);
  30. /*** execute the prepared statement ***/
  31. $querya->execute();
  32. /*** fetch the results ***/
  33. $resultya = $querya->fetchAll();
  34. foreach($resultya as $rowa)
  35. {
  36. $city_name = htmlentities($rowa['city'], ENT_QUOTES, 'utf-8');
  37. }
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement