Open the page in a browser, view the source, and post the javascript output 
here.  I suspect the issue is manifold, as you are wrapping each row of 
data in a double set of brackets (once in the string, and a second in the 
javascript).  Also, you are calling the second index of the $string and 
$string2 arrays, which may not exist, depending on how many rows of data 
are returned by your query.

On Monday, September 9, 2013 1:49:34 PM UTC-4, fekri elfarhani wrote:
>
> Hi 
>
> why cant display my data from my database ? i think that there's something 
> wrong with the array of javascript (Bold script), could you help me to find 
> a solution thank you
>  
> <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>    
>     <?php $sql11= "SELECT *
>  FROM stock
> WHERE MONTH(date) =  MONTH(CURRENT_DATE())
> GROUP BY date";
>
> $sth11 = mysql_query($sql11) or die(mysql_error());
>
>
>
>
> $string[] = "['option', 'value']";
> $string2[] = "['option', 'value']";
> while($r = mysql_fetch_assoc($sth11)) {
>    
> $date = $r['date'];
> $nom1 = $r['pet 2l'];
> $nom2 = $r['pet 1,5l'];
> $nom3 = $r['pet 1l'];
> $nom4 = $r['pet 50cl'];
> $nom5 = $r['pet 33cl'];
> $nom6 = $r['can 33cl'];
> $nom7 = $r['can 25cl'];
> $nom8 = $r['Rb 25cl'];
> $nom9 = $r['Rb 35cl'];
>  $string2[] = "['date', 'pet 2l', 'pet 1,5', 'pet 1l', 'pet 50cl', 'pet 
> 33cl', 'can 33cl', 'can 25cl', 'Rb 25cl', 'Rb 35cl']";
>
> $string[]="['".$date."',".$nom1.",".$nom2.",".$nom3.",".$nom4.",".$nom5.",".$nom6.",".$nom7.",".$nom8.",".$nom9."]";
> }echo "hhhh  ".$string[1]; ?>
>      <script type="text/javascript">
>       function drawVisualization() {
>         // Some raw data (not necessarily accurate)
>        * var data = google.visualization.arrayToDataTable([ *
> *        [<?php echo(implode(",", $string2[1]));?>],*
> *         [<?php echo(implode(",", $string[1]));?>]*
>         ]);
>
>
>        var options = {
>           title : 'Monthly Coffee Production by Country',
>           vAxis: {title: "Cups"},
>           hAxis: {title: "Month"},
>           seriesType: "bars",
>           series: {5: {type: "line"}}
>         };
>
>         var chart = new 
> google.visualization.ComboChart(document.getElementById('chart_div3'));
>         chart.draw(data, options);
>       }
>       google.setOnLoadCallback(drawVisualization);
>     </script>
>

-- 
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/groups/opt_out.

Reply via email to