Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getBeaches() {
- $sql="SELECT * FROM `beaches` WHERE city=:city";
- try {
- $db = getConnection();
- $stmt = $db->prepare($sql);
- $stmt->bindValue(':city', 'seattle'); //should bind seattle
- $stmt->execute();
- $beaches = $stmt->fetchObject();
- $db = null;
- echo '{"map": ' . stripslashes(json_encode($beaches)) . '}';
- } catch(PDOException $e) {
- echo '{"error":{"text":'. $e->getMessage() .'}}';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement