Hi everybody,
I am getting an odd behavior when I am trying to display a string column,
called "Series Name", through a google table chart
<https://developers.google.com/chart/interactive/docs/gallery/table>.
You can find my php code below. Please note that if I drop the column
"Series Name" everything works fine. Otherwise, the output table
displays only the first 5 rows. Specifically, leaving the mentioned column
if I set LIMIT >= 5 no table chart is created.
Let me stress that this issue appears on a new VPS where php and mysql db
have been installed. Same code works on my old VPS as expected.
Any ideas how to overcome this issue?
Thanks in advance,
Drigo
<?php
try {
/* Establish the database connection */
$conn = new PDO("mysql:host=localhost;dbname=$dbname", $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/* select relevant info for table googlechart */
$result_RTI_VS_W_TABLE = $conn->query("SELECT * FROM
`video_series_rank_week` ORDER BY `Year` DESC, `WeekN` DESC, `Rank` ASC LIMIT
15");
$rows_RTI_VS_W_TABLE = array();
$table_RTI_VS_W_TABLE = array();
$table_RTI_VS_W_TABLE['cols'] = array(
/* Labels for your chart, these represent the column titles */
array('label' => 'Rank', 'type' => 'number'),
array('label' => 'Year', 'type' => 'string'),
array('label' => 'WeekN', 'type' => 'number'),
array('label' => 'Series Name', 'type' => 'string'),
array('label' => 'Total Historical Constrained Ad Avails', 'type' =>
'number')
);
/* Extract the information from $result */
foreach($result_RTI_VS_W_TABLE as $r_RTI_VS_W_TABLE) {
$temp_RTI_VS_W_TABLE = array();
/* the following line will be used to get a table */
$temp_RTI_VS_W_TABLE[] = array('v' => (int) $r_RTI_VS_W_TABLE['Rank']);
/* Values */
$temp_RTI_VS_W_TABLE[] = array('v' => (string)
$r_RTI_VS_W_TABLE['Year']);
$temp_RTI_VS_W_TABLE[] = array('v' => (int) $r_RTI_VS_W_TABLE['WeekN']);
$temp_RTI_VS_W_TABLE[] = array('v' => (string)
$r_RTI_VS_W_TABLE['Series Name']);
$temp_RTI_VS_W_TABLE[] = array('v' => (int) $r_RTI_VS_W_TABLE['Total
Historical Constrained Ad Avails']);
$rows_RTI_VS_W_TABLE[] = array('c' => $temp_RTI_VS_W_TABLE);}
$table_RTI_VS_W_TABLE['rows'] = $rows_RTI_VS_W_TABLE;
/* convert data into JSON format */
$jsonTable_RTI_VS_W_TABLE = json_encode($table_RTI_VS_W_TABLE);
} catch(PDOException $e) {echo 'ERROR: ' . $e->getMessage();}
?>
--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/6bd93c31-ef17-4b5e-b9e6-962f8cefc593%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.