I having an issue with a query output where is only outputing one product instead of all the products matching WHERE shelf='KDR'. Here is the code
<?php include_once('../../header.php'); ?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript">
$(function () {
$('#KDR').highcharts({
chart: {
type: 'pie',
options3d: {
enabled: true,
alpha: 45
}
},
title: {
text: 'Current Inventory'
},
plotOptions: {
pie: {
innerSize: 100,
depth: 45
}
},
series: [{
name: 'In Stock',
data: [
<?php
$query_products = mysql_query("SELECT * FROM product, product_amount WHERE shelf='KDR'");
while($list_products = mysql_fetch_assoc($query_products))
{
$products['id'] = $list_products['id'];
$products['status'] = $list_products['status'];
$products['code'] = $list_products['code'];
$products['name'] = $list_products['name'];
$products['amount'] = $list_products['amount'];
$dump = array();
}
$result1= $products['name'];
$result2= $products['amount']
?>
['<?php echo $result1?>', <?php echo $result2?>], ] }] }); }); </script> <div class="row"> <H1>KDR</H1> <div id="KDR" style="width:50%; height:400px;"> </div> </div> <?php include_once('../../footer.php'); ?>
he querry appears to work, but when I echo the result I get: ['product 1 name', 'product 1 amount' ], instead of : ['product 1 name', 'product 1 amount' ], ['product 2 name', 'product 2 amount' ], ['product 3 name', 'product 3 amount' ], ['product 4 name', 'product 4 amount' ], ['product 5 name', 'product 5 amount' ], ['product 6 name', 'product 6 amount' ],
attached are images of the tables structure
any ideas?