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/thread/4dc84221fbd3ade5/6b733c72cb6f156e?hl=en#6b733c72cb6f156e 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 -~----------~----~----~----~------~----~------~--~---
