If you want a more complete solution (and most likely significantly
faster for large datasets), I wrote a google datasource library in
php. It supports the full datasource query language, and has a built
in wrapper for mysql.

You can find the project here: http://code.google.com/p/vis-table,
with details of how to integrate with a mysql database here:
http://code.google.com/p/vis-table/wiki/mysql_vistable.

Mark

On Nov 9, 5:21 am, rcrisman <[email protected]> wrote:
> Here is how I did it.  I suggest you pay close attention to the SQL
> query.
>
> http://groups.google.com/group/google-visualization-api/browse_thread...
>
> On Nov 7, 4:54 am, Gareth Jones <[email protected]> wrote:
>
> > Hi,
>
> > I'd like to create a Google Vizualization of some data in a MySql
> > Database and I'm having problems.
>
> > Here is the source so far:
>
> > <?php
> > $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
> > connecting to mysql');
> > mysql_select_db($dbname);
> > $int_y_pos = -1;
> > $int_y_step_small = 1;
> > $sql = "SELECT * from table')";
> > $sql = mysql_query($sql);
> > $rownum = mysql_num_rows($sql);
> > ?>
> > <html>
> >   <head>
> >     <script type="text/javascript" src="http://www.google.com/
> > jsapi"></
> > script>
> >     <script type="text/javascript">
> >       google.load("visualization", "1", {packages:
> > ["table"]});
> >       google.setOnLoadCallback(drawData);
> >       function drawTable() {
> >         var data = new google.visualization.DataTable();
> >         data.addColumn('string', 'column1');
> >         data.addColumn('string', 'column2');
> > <?php
> > echo "     data.addRows($rownum);\n";
> > while($row = mysql_fetch_assoc($sql)) {
> >         $int_y_pos += $int_y_step_small;
> >         echo "     data.setValue(" . $int_y_pos . ", 0, new column1
> > (" .
> > $row['column1']  . "));\n";
> >         echo "     data.setValue(" . $int_y_pos . ", 0, new column2
> > (" .
> > $row['column2']  . "));\n";
>
> > }
>
> > ?>
>
> > Any help or examples of previous previous integrations would be great.
>
> > Thanks
>
> > Gareth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to