Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2015 17:40
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/baf9a60c24b98cb85032 to your computer and use it in GitHub Desktop.
Save anonymous/baf9a60c24b98cb85032 to your computer and use it in GitHub Desktop.
<?php
$name= $_POST['name'];
$query= "SELECT $name FROM markers;
$pdo=new PDO("mysql:dbname=markers;host=127.0.0.1","root","");
$stmt = $pdo->query($query);
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
json_encode($results);
?>
$(function(){
$.ajax({
url: 'dbinfo.php',
data: {
name: $nameFromMainSite,
},
dataType: 'json',
success: function(data)
{
console.log(data);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment