Advertisement
Guest User

doesnt work

a guest
Jul 16th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. function getBeaches() {
  2.  
  3.     $sql="SELECT * FROM `beaches` WHERE city=:city";
  4.  
  5.     try {
  6.         $db         = getConnection();
  7.         $stmt       = $db->prepare($sql);
  8.  
  9.             $stmt->bindValue(':city',   'seattle'); //should bind seattle
  10.             $stmt->execute();
  11.  
  12.         $stmt       = $db->query($sql); var_export($stmt);
  13.         $beaches    = $stmt->fetchObject();
  14.         $db         = null;
  15.  
  16.         echo '{"map": ' . stripslashes(json_encode($beaches)) . '}';
  17.     } catch(PDOException $e) {
  18.         echo '{"error":{"text":'. $e->getMessage() .'}}';
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement