Oops, my mistake. Those "case" statements need a colon after each, like
this:
switch ((int) $r['id_respuesta']) {
case 8:
$type = 'word of mouth recomendation';
break;
case 9:
$type = 'magazine advertisement';
break;
case 10:
$type = 'roadside advertisement';
break;
default:
die('{"error":"Error in SQL query: unknown \'id_respuesta\'"}');
}
On Saturday, December 8, 2012 7:35:24 PM UTC-5, Chrystopher Medina wrote:
>
>
>
> i have an error like this : *Parse error*: syntax error, unexpected
> '$type' (T_VARIABLE) in *
> C:\xampp\htdocs\finalproyectoavandaro\reportegeneral.php* on line *39*
> *
> *
> *
> *
> *the error is in this part *
> *
> *
> *
> *
> *
> line 33: $rows = array();
> **
> line 34:
> while($r = mysql_fetch_assoc($query)){
> **
> line 35:
> $temp = array();
> **
> line 36:
> // using (int) $variable typecasts the variable as an integer, usefull
> when the SQL is returning numbers as strings
> **
> line 37:
> switch ((int) $r['id_respuesta']) {
> **
> line 38:
> case 8
> **
> line 39:
> $type = 'word of mouth recomendation'; //here is the problem
> **
> line 40:
> break;
> **
> line 41:
> case 9
> **
> line 42:
> $type = 'magazine advertisement';
> **
> line 43:
> break;
> **
> line 44:
> case 10
> **
> line 45:
> $type = 'roadside advertisement';
> **
> line 46:
> break;
> **
> line 47:
> default
> **
> line 48:
> die('{"error":"Error in SQL query: unknown \'id_respuesta\'"}');
> **
> line 49:
> }
> line 50:
> line 51:
> $temp[] = array('v' => $type);
> **
> line 52:
> $temp[] = array('v' => (int) $r['cnt']);
> **
> line 53:
> $rows[] = array('c' => $temp);
> **
> line 54:
> }
>
> *
> *
> *
> *
> *
>
--
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/-/gteXp0bnG28J.
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.