This isn't causing your problem, but since your "capacidadMW" is a decimal
type, and not an integer, you should probably change (int)
$r['capacidadMW']); to (float) $r['capacidadMW']);
That aside, I don't see anything in your code that would truncate the
results. Try running this and see what number is displayed:
<?php
include('connect-db.php');
$sth = mysql_query("SELECT planta, capacidadMW FROM planta");
echo mysql_num_rows($sth);
?>
If that shows 55 records, then there is a problem in the PHP; if it shows
less than 55, then there is a problem with your connection to the database.
On Wednesday, December 12, 2012 12:17:24 PM UTC-5, Ian Haylock wrote:
>
> just to let u know, the "planta" record in my table is type Varchar(45)
> and the "capacidadMW" is type decimal (9,2)
>
> On Wednesday, December 12, 2012 11:03:40 AM UTC-6, Ian Haylock wrote:
>>
>> thanks for the reply ..
>>
>> the query im using in phpmyadmin showing 55 records: SELECT planta,
>> capacidadMW FROM planta;
>>
>> the code using to encode using JSon (result is only 14 records):
>>
>> <?php
>>
>> include('connect-db.php');
>>
>> $sth = mysql_query("SELECT planta, capacidadMW FROM planta");
>> $rows = array();
>> $flag = true;
>>
>> $table = array();
>> $table['cols'] = array(
>>
>> array('label' => 'planta', 'type' => 'string'),
>> array('label' => 'capacidad en MW', 'type' => 'number')
>> );
>>
>> $rows = array();
>> while($r = mysql_fetch_assoc($sth)) {
>> $temp = array();
>> $temp[] = array('v' => (string)$r['planta']);
>> $temp[] = array('v' => (int) $r['capacidadMW']);
>> $rows[] = array('c' => $temp);
>> }
>>
>> $table['rows'] = $rows;
>>
>> $jsonTable = json_encode($table);
>>
>> echo $jsonTable;
>> ?>
>>
>>
>> On Wednesday, December 12, 2012 10:55:45 AM UTC-6, asgallant wrote:
>>>
>>> At a guess, I would say you have an error in the SQL in PHP. If you
>>> post your PHP code, I'll take a look at it.
>>>
>>> On Wednesday, December 12, 2012 11:41:25 AM UTC-5, Ian Haylock wrote:
>>>>
>>>> Hi asgallant, thank you very much for th taking the time to help
>>>> others. i have a question if you dont mind, i followed Diana´s sample and
>>>> got it to work, well sort of, i used my onw db and managed to show the
>>>> graph and everithing, the only thing is that my mysql query running in
>>>> phpmyadmin shows 55 records and my json result shows only 14 records, how
>>>> is that possible ???
>>>>
>>>> On Wednesday, December 12, 2012 12:54:06 AM UTC-6, Chrystopher Medina
>>>> wrote:
>>>>>
>>>>>
>>>>> ok im gonna start with the php information. and u know i have another
>>>>> problem how i cant charge two pie charts in the same place but each with
>>>>> different results.... u know i have two questions and i want to charge
>>>>> the
>>>>> results from them. in two pie charts..... because i read that just one
>>>>> pie
>>>>> chart can be charged in the same place.... i could be mistaken
>>>>
>>>>
--
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/-/TUVp37ahCn0J.
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.