Thank asgallant,
Now i want try to have two tableS in my database, lets say table A and
table B, so what is the writing format in php and html...
*Goo.php*
//retrieve data from Table A
<?php
$con=mysql_connect("localhost","root","") or die("problemas al conectarse
al server!!!!");
mysql_select_db("epat", $con);
$sth = mysql_query("SELECT * FROM A");
$rows = array();
$flag = true;
$table = array();
$table['cols'] = array(
array('label' => 'U', 'type' => 'string'),
);
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$temp = array();
$temp[] = array('v' => (string) $r['U']);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
echo $jsonTable;
?>
//retrieve data from Table B
<?php
$con=mysql_connect("localhost","root","") or die("problemas al conectarse
al server!!!!");
mysql_select_db("epat", $con);
$sth = mysql_query("SELECT * FROM A");
$rows = array();
$flag = true;
$table = array();
$table['cols'] = array(
array('label' => 'T', 'type' => 'string'),
);
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$temp = array();
$temp[] = array('v' => (string) $r['T']);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
echo $jsonTable;
?>
*HTML*
Chart for tableA
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});
google.setOnLoadCallback(drawChart);
function drawChart1() {
var jsonData =$.ajax({
url: "Goo.php",
dataType:"json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
.........
</script>
Chart for TableB
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});
google.setOnLoadCallback(drawChart);
function drawChart2() {
var jsonData =$.ajax({
url: "Goo.php",
dataType:"json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
.........
</script>
Please correct me If I'm wrong?
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.