SHOW:
|
|
- or go back to the newest paste.
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 | $beaches = $stmt->fetchObject(); | |
12 | - | $stmt = $db->query($sql); var_export($stmt); |
12 | + | |
13 | ||
14 | echo '{"map": ' . stripslashes(json_encode($beaches)) . '}'; | |
15 | } catch(PDOException $e) { | |
16 | echo '{"error":{"text":'. $e->getMessage() .'}}'; | |
17 | } | |
18 | ||
19 | } |