We're going to have to work on the PHP a bit here. There are two different
paths to take to correct it, depending on what you actually want to get at
the end.
The way you started this, you would get a table that looks like this:
word of mouth recomendation | magazine advertisement | roadside
advertisement
-------------------------------------------------------------------------------------
XXXX | YYYY | ZZZZ
Which is fine for producing a table output of your data, but not very good
if you want to produce a chart. Charts would do better with an output like
this:
Type | Count
-----------------------------------
word of mouth recomendation | XXXX
magazine advertisement | YYYY
roadside advertisement | ZZZZ
What kind of visualization do you want to make with the data?a
On Friday, December 7, 2012 3:01:52 AM UTC-5, Chrystopher Medina wrote:
>
>
>
> hi my friend i´ve finished this. my result file json is this:
>
> {"cols":[{"label":"word of mouth
> recomendation","type":"number"},{"label":"magazine
> advertisement","type":"number"},{"label":"roadside
> advertisement","type":"number"}],"rows":[{"c":[{"v":"2"}]},{"c":[{"v":"1"}]},{"c":[{"v":"1"}]}]}
>
>
>
> i hope that this be the correct result......
> look my php file:: my php file is this
>
> :
> <?php
> $var1="$_POST[fecha1]";
>
> $var2= "$_POST[fecha2]";
>
> $server="localhost";
> $username="root";
> $password="chrystopher";
> $databasename="encuestasavandaro";
>
> $con= mysql_connect($server,$username,$password)
> or die('Error connecting to server');
> mysql_select_db($databasename,$con);
>
> $query= mysql_query("select count(b.id_respuesta) from huesped a,
> rompe_encuesta b
> where
> b.id_huesped=a.id_huesped and b.id_aspecto=1 and b.id_respuesta=8 and
> a.fecha between '$var1' and '$var2';");
>
> $query2= mysql_query("select count(b.id_respuesta) from huesped a,
> rompe_encuesta b
> where
> b.id_huesped=a.id_huesped and b.id_aspecto=1 and b.id_respuesta=9 and
> a.fecha between '$var1' and '$var2';");
>
> $query3= mysql_query("select count(b.id_respuesta) from huesped a,
> rompe_encuesta b
> where
> b.id_huesped=a.id_huesped and b.id_aspecto=1 and b.id_respuesta=10 and
> a.fecha between '$var1' and '$var2';");
>
>
> $table = array();
>
> $table['cols']=array(
>
> array('label' => 'word of mouth recomendation'
> , 'type'=>'number'),
> array('label' => 'magazine advertisement'
> , 'type'=>'number'),
> array('label' => 'roadside advertisement'
> , 'type'=>'number')
>
>
> );
>
>
> $rows = array();
> while($r= mysql_fetch_assoc($query)){
>
> $temp = array();
> $temp[]=array('v' => $r['count(b.id_respuesta)']);
>
>
> $rows[] = array('c' => $temp);
> }
> while($r= mysql_fetch_assoc($query2)){
>
> $temp = array();
> $temp[]=array('v' => $r['count(b.id_respuesta)']);
>
>
> $rows[] = array('c' => $temp);
> }
> while($r= mysql_fetch_assoc($query3)){
>
> $temp = array();
> $temp[]=array('v' => $r['count(b.id_respuesta)']);
>
>
> $rows[] = array('c' => $temp);
> }
>
>
> $table['rows']=$rows;
>
> $jsonTable= json_encode($table);
> echo $jsonTable;
>
>
> ?>
>
>
>
>
>
>
>
>
>
--
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/-/pJqojCWsz1EJ.
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.