Your code is mostly good. I made a few edits, try out these and see if they work for you. If the don't, then open the try1.php file in a browser, view source, and copy the rendered javascript here (it is important to do this from the browser so I can see what is being output by your PHP).
On Friday, March 15, 2013 5:02:03 AM UTC-4, [email protected] wrote: > > help me please:( > i attach the file of html and php > i do not know where is the error > > > > On Thursday, December 6, 2012 9:46:00 AM UTC+3, asgallant wrote: >> >> Ok, here's example PHP to get you started: >> >> <?php >> /* $server = the IP address or network name of the server >> * $userName = the user to log into the database with >> * $password = the database account password >> * $databaseName = the name of the database to pull data from >> */ >> $con = mysql_connect($server, $userName, $password) or die('Error >> connecting to server'); >> >> mysql_select_db($databaseName, $con); >> >> // write your SQL query here (you may use parameters from $_GET or $_POST >> if you need them) >> $query = mysql_query('SELECT column1, column2, column3 FROM myTable'); >> >> $table = array(); >> $table['cols'] = array( >> /* define your DataTable columns here >> * each column gets its own array >> * syntax of the arrays is: >> * label => column label >> * type => data type of column (string, number, date, datetime, boolean) >> */ >> array('label' => 'Label of column 1', 'type' => 'string'), >> array('label' => 'Label of column 2', 'type' => 'number'), >> array('label' => 'Label of column 3', 'type' => 'number') >> // etc... >> ); >> >> $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['column1']); >> $temp[] = array('v' => $r['column2']); >> $temp[] = array('v' => $r['column3']); >> // etc... >> // insert the temp array into $rows >> $rows[] = array('c' => $temp); >> } >> >> // populate the table with rows of data >> $table['rows'] = $rows; >> >> // encode the table as JSON >> $jsonTable = json_encode($table); >> >> // return the JSON data >> echo $jsonTable; >> ?> >> >> You will have to fill in the database connection information, write your >> SQL query, define the columns in $table['cols'], and adjust the while loop >> to ensure that all columns of data get populated. You should be able to >> navigate to that page in your browser and see a string of JSON data. When >> you have a basic version running, I'll help you hook it up to your chart(s). >> >> On Wednesday, December 5, 2012 10:54:01 PM UTC-5, Chrystopher Medina >> wrote: >>> >>> hi my frined thanks for answering me my question. could you be more >>> expecific u know i really dont know speak english very well. and i just >>> began to study this about how to program whit ajax .... really its posible >>> .... could u help me my friend could u give me ur email or ur facebook >>> page. or something like that. ....... its very important to me to do this. >>> i ve spend months with this work. and it doesnt work ....... please >>> explaime how i can do in order to achieve this ............ >>> >>> -- 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.
Choose Type of Chart:
Note: Bar chart show last 7 measures..
Pie chart show all measures
Pie Chart Bar Chart
<<attachment: try1.php>>
