Hi there -
I figured out how to put my data into a JSON format using PHP and MySQL,
see below. Now, could someone please help me create, say, a pie chart with
Google Charts. I have not done this before, and I could use some help
creating it.
<?php
// Connect to MySQL
include ("./mylibrary/login.php");
login();
// Fetch the data
$query = "
SELECT priority, COUNT(*) AS num_count\n"
. " FROM issue\n"
. " GROUP BY priority ";
$result = mysql_query( $query );
// All good?
if ( !$result ) {
// Nope
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die( $message );
}
// Print out rows
$prefix = '';
echo "[\n";
while ( $row = mysql_fetch_assoc( $result ) ) {
echo $prefix . " {\n";
echo ' "priority": "' . $row['priority'] . '",' . "\n";
echo ' "num_count": ' . $row['num_count'] . "\n";
echo " }";
$prefix = ",\n";
}
echo "\n]";
?>
Thank you,
Hugo
--
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/groups/opt_out.