Hi, I am facing these problem. I gt 4 category. So for each category, I want to count number of people in each of it.I already have the query but i dont know how to put it in array with $i =$i +1 to count it when no of people increase in the category. I really hope you can help to generate the pie chart.
<?
$result= array("SELECT * FROM ray, hello,category WHERE
ray.hello_id = hello.hello_id AND hello.category_id = category.category_id AND
category.category_id= '1' ");
$i =0;
while($row=mysql_fetch_array($result)){
$result[$i] = $row[0];
$i=$i +1;
}
<html>
<head>
<title>hello</title>
<link class="include" rel="stylesheet" type="text/css" href="jqplot_files/jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="jqplot_files/examples.min.css" />
<link type="text/css" rel="stylesheet" href="jqplot_files/syntaxhighlighter/styles/shCoreDefault.min.css" />
<link type="text/css" rel="stylesheet" href="jqplot_files/syntaxhighlighter/styles/shThemejqPlot.min.css" />
<script class="include" type="text/javascript" src="script/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jqplot_files/syntaxhighlighter/scripts/shCore.min.js"></script>
<script type="text/javascript" src="jqplot_files/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
<script type="text/javascript" src="jqplot_files/syntaxhighlighter/scripts/shBrushXml.min.js"></script>
<script class="include" type="text/javascript" src="jqplot_files/jquery.jqplot.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="jqplot_files/plugins/jqplot.pieRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="jqplot_files/plugins/jqplot.donutRenderer.min.js"></script>
<script type="text/javascript" src="jqplot_files/example.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var data2 = [
[<?php echo $row1['category_name']; ?>,<?php echo $row[0]; ?>],
[<?php echo $row2['category_name']; ?>, <?php echo $numrows02; ?>],
[<?php echo $row3['category_name']; ?>, <?php echo $numrows03; ?>],
[<?php echo $row4['category_name']; ?>, <?php echo $numrows04; ?>]
];
var plot2 = jQuery.jqplot ('chart2', [data2],
{
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Turn off filling of slices.
fill: false,
showDataLabels: true,
// Add a margin to seperate the slices.
sliceMargin: 4,
// stroke the slices with a little thicker line.
lineWidth: 5
}
},
legend: { show:true, location: 'e' }
}