Skip to content

Instantly share code, notes, and snippets.

Created September 13, 2015 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/cdeae8c3606aa443a439 to your computer and use it in GitHub Desktop.
Save anonymous/cdeae8c3606aa443a439 to your computer and use it in GitHub Desktop.
<?php
$pdo=new PDO("mysql:dbname=markers;host=127.0.0.1","root","");
$stmt = $pdo->query("SELECT * FROM markers");
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
//var_dump($results);
$json=json_encode($results);
?>
<script type="text/javascript">
var ary = <?php echo json_encode($json); ?>;
alert(ary[1].Key);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment