By: Crhis
Date: 2016-03-07
Time: 23:44
|
Chart merge problem with Mysql & arrayHello,
I'm trying to merge some data from my Mysql DB with a PPTX chart, but I do not succeed. In PHP file I've got the following code : [CODE] $liste = array(); $requete = mysql_query(" SELECT name, amount FROM mytable"); while($row = mysql_fetch_array($requete)){ $liste[] = $row; } // Merge a chart $ChartRef = 'graphic'; // objet cible dans le PPTX slide N°2 $SeriesNameOrNum = 1; //$NewValues = array( array('Cat. A','Cat. B','Cat. C','Cat. D'), array(5, 8, 12, 25) ); // If I activate this line, everything works fine $NewValues = $liste; // If I activate this line, to use the DB data, it does not work at all. $NewLegend = "Merged"; $TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend); [/CODE] Please, can somebody help me ? Many thanks in advance for your help. Crhis |
By: Skrol29
Date: 2016-03-11
Time: 21:26
|
Re: Chart merge problem with Mysql & arrayHi Crhis,
Your data $liste is structured like a recordset array(array('name' => ..., 'amount' => ...), array('name' => ..., 'amount' => ...)) while the OPENTBS_CHART command needs another structure See http://www.tinybutstrong.com/opentbs.php?doc#chart |