siric

Members
  • Content count

    8
  • Joined

  • Last visited

Everything posted by siric

  1. Piechart and MySQL

    Hi, I am trying to create a piechart under the following circumstances: My each row in my table contains a gender. I want to be able to sum up the number of males and females and then plot that in a pie chart. The query that I am using SELECT SUM(gender = 'male') AS male, SUM(gender = 'female') AS female FROM markers; presents 2 columns (male and female) with a count below. How is it possible to get this into the array for the chart seeing that the data required should be by row rather than column? Query Results: | male | female | | 23 | 43 | Should be | male | 23 | | female | 43 | Thanks Steve
  2. Piechart and MySQL

    SELECT gender, COUNT(*) AS COUNT FROM markers GROUP BY gender;
  3. Hi, I am trying to get a real-time angular gauge with data from a mysql table. I am trying to use the dataStreamURL but my question is how do I get the returned data into the dial value? Gauge.html <div class="gen-chart-render"> <div id="chartContainer">FusionWidgets will load here</div> <script type="text/javascript"><!-- var myChart = new FusionCharts( "../../Charts/AngularGauge.swf", "myChartId", "400", "200", "0", "1" ); myChart.setXMLData('<chart lowerLimit="0" upperLimit="100" lowerLimitDisplay="Good" upperLimitDisplay="Bad" numberSuffix="%" showValue="1" dataStreamURL="getutil.php" refreshInterval="3">\n\ <colorRange>\n\ <color minValue="0" maxValue="50" code="8BBA00"/>\n\ <color minValue="50" maxValue="80" code="F6BD0F"/>\n\ <color minValue="80" maxValue="100" code="FF654F"/>\n\ </colorRange>\n\ <dials>\n\ <dial value="0" />\n\ </dials>\n\ </chart>'); myChart.render("chartContainer"); // --> </script> </div> getutil.php $username = "xxx"; $password = "yyy"; $db = "fusionchartsdb"; $hostname = "localhost"; // make connection to database mysql_connect($hostname, $username, $password) or die("Unable to connect to host $hostname"); mysql_select_db($db) or die("Unable to select database $db"); $portid='1'; $strSQL = "SELECT util from utilisation WHERE portid = '$portid'"; $result=mysql_query($strSQL) or die(mysql_error()); $util = mysql_result($result,0,"util"); print $util; I have checked the getutl by itself and it is working fine. Thanks
  4. Ok, I think I got it.. I changed the print statement to print "value=".$util; Thanks