I'm glad you got it to work, but I'd like to suggest another option to try
that doesn't involve messing with php.ini. Assuming you are using PHP 5.3
or newer, you should have PDO packaged with your install. PDO is a
database interface that can access many different kinds of databases
(MySQL, SQLite, Oracle, etc) using a common interface, and has some built
in features that are worth getting to know (especially if you plan to do a
lot of PHP work with databases). Go back to the older setting in php.ini
(and the larger data set, if that's feasible) and try this:
try {
$db = new PDO("mysql:dbname=$databaseName", $username, $password);
}
catch (PDOException $e) {
echo $e->getMessage();
}
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = $db->prepare("SELECT * FROM testpower WHERE datetime > 0");
$query->execute();
$results = $query->fetchAll(PDO::FETCH_ASSOC);
$flag = true;
$table = array();
$table['cols'] = array(
array('label' => 'date', 'type' => 'datetime'),
array('label' => 'power', 'type' => 'number')
);
$table['rows'] = array();
foreach ($results as $row) {
$temp = array();
$dateTimeArr = explode(' ', $row['datetime']);
$dateArr = explode('-', $dateTimeArr[0]);
$timeArr = explode(':', $dateTimeArr[1]);
$year = $dateArr[0];
$month = $dateArr[1] - 1; // months are zero-indexed
$day = $dateArr[2];
$hour = $timeArr[0];
$min = $timeArr[1];
$sec = $timeArr[2];
$temp[] = array('v' => "Date($year, $month, $day, $hour, $min, $sec)";
$temp[] = array('v' => (int) $row['power']);
$table['rows'][] = array('c' => $temp);
}
$jsonTable = json_encode($table);
See how that does for you.
On Monday, July 16, 2012 7:37:05 PM UTC-4, shown wrote:
>
> I got it to work by bumping the php.ini to 64MB and halving the data.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/VZJe9FDTj0kJ.
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.