我有一个用于显示折线图的JavaScript。但是,我想要做的是从mysql数据库中提取图表数据
所以我改变了js以获得我的mysql和php变量但是现在当我执行打击代码并且不确定如何解决它时我得到500错误。
<!-- Morris chart - Sales -->
<div class="chart tab-pane active" id="revenue-chart" style="position: relative; height: 300px;"></div>
</div>
<script>
/* Morris.js Charts */
// Sales chart
var area = new Morris.Area({
element : 'revenue-chart',
resize : true,
data : [
<?php
$custservnumsql = mysqli_query($conn, "SELECT count(noteid) as noteid, monthname(date_written), YEAR(date_written)
FROM customer_notes where is_staffreply is null
GROUP BY YEAR(date_written), MONTH(date_written) DESC");
while($custservnumrow = mysqli_fetch_array($custservnumsql)
{
extract($custservnumrow);
?>
{ y: "<?php echo $date_written; ?> Q1", numrequests: <?php echo "$noteid; ?>}
<?php
}
?>
],
xkey : 'y',
ykeys : ['numrequests'],
labels : [Number Of Requests',],
lineColors: ['#a0d0e0'],
hideHover : 'auto'
});
</script>