I'm attempting to read in a user's weightlifting history from a database using a php file(viewworkout.php) to first run the query and then a js file to get the results from the query. the script below is all i have so far, and it
<script type="text/javascript">
<?php include("viewworkout.php");
echo "var numrecords = $numrows;\n";
echo "var muscle = new Array();\n" ;
echo "var exercise = new Array();\n" ;
echo "var set = new Array();\n" ;
echo "var weight = new Array();\n" ;
echo "var reps = new Array();\n" ;
echo "var difficulty = new Array();\n" ;
for($i = 0; $i < $numrows; $i++){
echo "var muscle[$i] = \"".$muscle[$i]."\";\n";
}
?>
</script>
The javascript debugger gives the error -
"missing ; before statement"
but the generated code(shown below) looks fine.
what am I doing wrong?
The line numbers are from the debugger btw.
20var muscle[0] = "Calves";
21var muscle[1] = "Calves";
22var muscle[2] = "Lats";
23var muscle[3] = "LowerBack";
24var muscle[4] = "LowerBack";
25var muscle[5] = "Quads";
26var muscle[6] = "Quads";
27var muscle[7] = "Quads";
28var muscle[8] = "Quads";
29var muscle[9] = "Traps";
30var muscle[10] = "Traps";
31var muscle[11] = "Traps";
32var muscle[12] = "Biceps";
33var muscle[13] = "Biceps";
34var muscle[14] = "Biceps";
35var muscle[15] = "Biceps";
36var muscle[16] = "Lats";
.......ect
Thanks in advanced