Hi all, im using Google Charts to process graphs based on data in a database which is working fine.
However now i need to get data from a database (Users from a specific area) and then get data from a different table (How many submissions one user from that area has made) and then process that into a graph.
Currently this posts the data for the first user in the graph with no issue, however it doesn't repeat the line i have highlighted in red, which i believe is the issue.
<? $rs1_settings = mysql_query("select * from users WHERE `area`='$area' ORDER BY `full_name` ASC"); ?>
<?php while ($row1_settings = mysql_fetch_array($rs1_settings)) {
$user_id = $row1_settings['id'];
$user_name = $row1_settings['full_name'];
$id = mysql_query("select count(*) as total_all from issues WHERE `created_by_id` = '$user_id' AND `completed` = '0'");
list($uid) = mysql_fetch_row($id);
?>
<!--Load the AJAX API-->
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Channel');
data.addColumn('number', 'Issues');
data.addRows([
['<? echo $user_name; ?>', <?php echo $uid; ?>],
]);
// Set chart options
var options = {'title':'Compliance issues by Channel:', 'width':500,
'height':400};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.ColumnChart(document.getElementById('chart_channel'));
chart.draw(data, options);
}
</script>
<? } ?>
<!--Div that will hold the pie chart-->
<div id="chart_channel"></div>