I seem to be having a bit of trouble. The PHP portion seems to work well, but I can't seem to get the info over to the JS portion. Here is what I currently have:
<!DOCTYPE html>
<html>
<body>
<?php
$servername = "localhost";
$username = "username";
$password = "password";
mysql_connect($servername, $username, $password) or die(mysql_error());
mysql_select_db("stuff") or die(mysql_error());
$result = mysql_query("SELECT Location, Latitude, Longitude FROM Places WHERE Latitude IS NOT NULL GROUP BY Location, Latitude, Longitude");
$places = array();
while (($row = mysql_fetch_array($result, MYSQL_NUM)) !== false) {
$places[] = $row;
}
?>
<script>
function makeTableHTML(myArray) {
var result = "<table border=1>";
for(var i=0; i<myArray.length; i++) {
result += "<tr>";
for(var j=0; j<myArray[i].length; j++){
result += "<td>"+myArray[i][j]+"</td>";
}
result += "</tr>";
}
result += "</table>";
return result;
}
var places = "<?php echo json_encode($places) ?>";
makeTableHTML(places);
</script>
</body>
</html>
I have tested the PHP portion and it works just fine. I am fairly new to the JS and I am not sure how I can go about testing/debugging this. Any help would be appreciated.
I found the makeTableHTML function on here in hopes that it would help, but I didn't have any luck.