this is my file prova.php that is file called by Ajax:
<?php
$q=$_GET["q"];
$p=$_GET["p"];
$parametro=$q;
$componente=$p;

$con = mysql_connect('localhost', 'root') or die('Error connecting to 
server');

mysql_select_db('effect_db',$con) or die ('Selezione Database non 
riuscita');

 $query = mysql_query('Select '.$parametro.',count('.$parametro.')as Numero 
>From detectedfaults where subsystemname="'.$componente.'"   group by 
'.$parametro.' ')or die("Query fallita");
 $table = array();
$table['cols'] = array(
    
    array('label' => $parametro, 'type' => 'string'),
    array('label'=> 'Numero','type'=>'number'),
 
);
$rows= array();
while($r = mysql_fetch_assoc($query)) {
    $temp = array();
    // each column needs to have data inserted via the $temp array

        $temp[] = array('v' =>  $r[$parametro]);
        $temp[] = array('v' =>  (int) $r['Numero']);
    $rows[]= array('c' =>$temp);
}
 
$table['rows'] = $rows;

// populate the table with rows of data

$jsonTable = json_encode($table);

// encode the table as JSON

//set up header; first two prevent IE from caching queries
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');

// return the JSON data

echo $jsonTable;

 ?>
 
and this example is json retuned hand setting $componente and $parametro in 
prova.php

{"cols":[{"label":"Severity","type":"string"},{"label":"Numero","type":"number"}],"rows":[{"c":[{"v":"block"},{"v":9}]},{"c":[{"v":"feature"},{"v":10}]},{"c":[{"v":"major"},{"v":152}]},{"c":[{"v":"minor"},{"v":13}]},{"c":[{"v":"text"},{"v":17}]},{"c":[{"v":"tweak"},{"v":5}]}]}
 



Il giorno sabato 14 giugno 2014 19:50:33 UTC+2, Andrew Gallant ha scritto:
>
> If you can post an example of the data returned by your AJAX call, I will 
> take a look and see if I can figure out what is wrong.
>
> On Saturday, June 14, 2014 4:12:25 AM UTC-4, Vincenzo Diligente Tizzani 
> wrote:
>>
>> Thank you for help,but in this way not display graph.
>> Have you same idea to solving this problem??
>> Thank you very much
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to