I forgot the $'s in front of the i's there, try this:
for ($i = 1; $i < count($rawRows[0]); $i++) {
On Wednesday, July 11, 2012 2:04:09 PM UTC-4, Adam Hardarson wrote:
>
> Hi again, thank you so much for your assistance!
>
> However it's not working so I the page for syntax error and got a Parse
> error: syntax error, unexpected T_INC, expecting ')' in test.php on line 37.
>
> That's where the for loop starts... I can't see what the problem might be?!
>
>
>> $result124 = mysql_query("
>> SELECT Matningsnamn AS Matning,
>> Value1,
>> Value2 ,
>> Value3 ,
>> Value4
>> FROM myDB WHERE Id ='$first' OR Id ='$second'"
>> );
>> $rawRows = array();
>> $cols = array();
>> // set up domain column
>> $cols[] = array(
>> 'type' => 'string',
>> 'label' => 'Value #'
>> );
>> while($r = mysql_fetch_assoc($result124)) {
>> $cols[] = array(
>> 'type' => 'string',
>> 'label' => $r['Matning']
>> );
>> $rawRows[] = $r;
>> }
>>
>> $outRows = array();
>> for ($i = 1; i < count($rawRows[0]); i++) {
>> $temp = array();
>> $temp[0] = array('v' => "Value$i");
>> for ($j = 0; j < count($rawRows); j++) {
>> if ($rawRows[$j]['Matning'] == $cols[1]['label']) {
>> $temp[1] = array('v' => $rawRows[$j]["Value$i"]);
>> }
>> else if ($rawRows[$j]['Matning'] == $cols[2]['label']) {
>> $temp[2] = array('v' => $rawRows[$j]["Value$i"]);
>> }
>> }
>> $outRows[] = array('c' => $temp);
>> }
>>
>> $dataTable = json_encode(array(
>> 'cols' => $cols,
>> 'rows' => $outRows
>> ));
>>
>> You can then output this into the DataTable constructor:
>>
>> var data = new google.visualization.DataTable(<?php echo $dataTable; ?>);
>>
>>
>
> Seeing the end of the tunnel... :)
>
> Adam
>
--
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/-/KPO4Jgk6jLMJ.
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.