Creating Graphs with php and mysql using google chart?
<p>i have trying to create some weekly based no.of.success and no.of.failure status.i have created the chart with google line chart option but it doesn't work when trying to get the values from the database.</p>

<p>my table name is :details</p>

<p>the code is follows:</p>

<pre><code>    $sql_no=mysql_query("SELECT COUNT(*) AS nof FROM details WHERE result=1");
    $call=mysql_fetch_assoc($sql_no);
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Month');
    data.addColumn('number', 'Success');
    data.addColumn('number', 'Failure');
    &lt;?php $results = array();
    while ($row = mysql_fetch_assoc($sql_no)){
    $num=$results[$row['nof']];
     }
    echo 'data.addRows('.count($results).');';
    $i = 0;
    foreach ($results as $value =&gt; $num){
    echo'
    data.setValue('.$i.', 0, "'.$value.'");
    data.setValue('.$i.', 1, '.$num.');
     ';
    $i++;
     }
?&gt; var options = {
      width: 800, height: 340,
      title: 'Call details'
    };
     var chart =
     new  google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, options);
     }
</code></pre>
