I am trying to write a script to produce a chart using HighCharts. I have an issue with a call to my data which is causing an error.
SyntaxError: missing ] after element list
This is the code I am using:
var data1 = [<?php
mysql_select_db($database_test, $con);
$query_result = sprintf("SELECT AName FROM Answers WHERE AName IS NOT NULL GROUP BY AName");
$result = mysql_query($query_result, $con) or die(mysql_error());
while ($row_result = mysql_fetch_assoc($result)){
?>
[<?php echo $row_result['AName'];?>],
<?php
}
?>
]
Trying to debug it in Firefox dev console it points to the above code as the cause. Can anyone see why it is falling over with the error "SyntaxError: missing ] after element list.
If I hard code the data it works fine.
Many thanks for any help you can give.