Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.