Dear Nitesh,

Could you upload your files "open.php" so i can run them on my wampserver 
and check your problem, and please send a txt file with a sample of your 
data "dummy data" structure table so i can make a copy of it in my 
phpmyadmin database ..? 


I am willing to help you trust me you seems you're getting the data right..


Best Regards,

Hisham 

On Friday, June 26, 2015 at 9:57:39 AM UTC+3, Nitesh Parajuli wrote:
>
> mysql_select_db($databaseName, $con); 
> this line is sending me html codes.why is that??  anyone??
>
> On Tuesday, February 26, 2013 at 3:04:09 AM UTC+5:45, asgallant wrote:
>
> You have to format the data returned by your query into the JSON format 
> expected by the DataTable constructor.  Here's a basic PHP script that you 
> can work from:
>
> <?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);
>
> // set up header; first two prevent IE from caching queries
> header('Cache-Control: no-cache, must-revalidate');
> header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
> header('Content-type: application/json');
>
> ...

-- 
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/d/optout.

Reply via email to