Good Afternoon, everyone.
I have an ongoing issue with the code below. I know that the Javascript/JQuery and JSON are working fine as demonstrated here - http://jsfiddle.net/Dvpmy/13/
I also know that the PHP works fine when my attempts at echoing the Javascript are omitted. However, when I combine everything, I seem to be experiencing issues. Chrome is flagging an 'Unexpected Identifier' and Firefox believes there is a missing closed parentheses after an argument. I am unable to find and remedy either.
<html>
<head>
<script type="text/javascript" src="/Portfolio/jquery.js"></script>
<?php
mysql_connect(localhost,"user","password");
@mysql_select_db("database") or die( "Unable to select database");
$query="SELECT * FROM quote WHERE view='yes'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$ID=mysql_result($result,$i,"ID");
$EPIC=mysql_result($result,$i,"EPIC");
echo '<script type="text/javascript">';
echo'$.getJSON("http://query.yahooapis.com/v1/public/yql? q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22DES%22%20and%20startDate%20%3D%20%222009-09-11%22%20and%20endDate%20%3D%20%222010-03-10%22&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?", function(data) { console.log(data); var info = data.query.results.quote[0].Close; var date = data.query.results.quote[0].Date; var high = data.query.results.quote[0].High; $("div.quote").html("Test" $ID <br> $EPIC <br> high ); } );';
echo '</script>';
$i++;
}
?>
</head>
<body><div class='quote'></div></body></html>
I would like to apologise in advance if the solution is glaringly apparent. All assistance will be gratefully received.
Many thanks.