Hi all,
I am facing a problem of displaying data from database into bar column using Yii Highcharts. I know the problem that I cant display the value of data from database is because of the string value instead of integer value. But, I don’t know how to convert the string value into integer value. Anyone can help me please? Thanks in advance.
view file
<?php
$xAxis = Yii::app()->db->createCommand()
->select('name')
->from('course_timetable')
->queryColumn();
$data = Yii::app()->db->createCommand()
->select('total_student')
->from('course_timetable')
->queryColumn();
$value=var_dump($data);
echo print_r($value);
$this->Widget('ext.highcharts.highcharts.HighchartsWidget',array(
'options' =>array(
'title' => array('text' => 'Total No. Of Students According To Course'),
'xAxis' => array(
'categories' => $xAxis,
),
'yAxis' => array(
'title' => array('text' => 'Total No. Of Students'),
),
'series' => array(
array('name' => 'Course',
'data' => $data, //error:cant show the value
'shadow' => false,
)
)
)
));
?>
When I print_r the value, it returns ‘[color="#FF0000"]array(5) { [0]=> string(3) “100” [1]=> string(2) “80” [2]=> string(2) “30” [3]=> string(2) “50” [4]=> string(2) “10” } 1[/color]’.
It is not correct and I wish to have the value in integer type like ‘[color="#FF0000"]array(5) { [0]=> int(3) “100” [1]=> int(2) “80” [2]=> int(2) “30” [3]=> int(2) “50” [4]=> int(2) “10” } 1[/color]’
Any idea how to convert from string value into integer value??