| | |
building graph with swf flash
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
i try to building graph with charts swf (flash)
from query table i have 2 field like year,num,
i want result from script like this
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 0 ][ 1 ] = "2001";
$chart [ 'chart_data' ][ 0 ][ 2 ] = "2002";
$chart [ 'chart_data' ][ 0 ][ 3 ] = "2003";
$chart [ 'chart_data' ][ 0 ][ 4 ] = "2004";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$chart [ 'chart_data' ][ 1 ][ 1 ] = 5;
$chart [ 'chart_data' ][ 1 ][ 2 ] = 10;
$chart [ 'chart_data' ][ 1 ][ 3 ] = 30;
$chart [ 'chart_data' ][ 1 ][ 4 ] = 63;
=====
i try to make script like this
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$bar=1;
while($row = mysql_fetch_array($resultmoto))
{
$data[] = $row[1];
$leg[] = $row[0];
$chart [ 'chart_data' ][ 0 ][ $bar ] = $data;
$chart [ 'chart_data' ][ $row ][ $bar ] = $leg,
$bar++;
}
but the result still cannot display.
please check
tx
from query table i have 2 field like year,num,
i want result from script like this
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 0 ][ 1 ] = "2001";
$chart [ 'chart_data' ][ 0 ][ 2 ] = "2002";
$chart [ 'chart_data' ][ 0 ][ 3 ] = "2003";
$chart [ 'chart_data' ][ 0 ][ 4 ] = "2004";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$chart [ 'chart_data' ][ 1 ][ 1 ] = 5;
$chart [ 'chart_data' ][ 1 ][ 2 ] = 10;
$chart [ 'chart_data' ][ 1 ][ 3 ] = 30;
$chart [ 'chart_data' ][ 1 ][ 4 ] = 63;
=====
i try to make script like this
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$bar=1;
while($row = mysql_fetch_array($resultmoto))
{
$data[] = $row[1];
$leg[] = $row[0];
$chart [ 'chart_data' ][ 0 ][ $bar ] = $data;
$chart [ 'chart_data' ][ $row ][ $bar ] = $leg,
$bar++;
}
but the result still cannot display.
please check
tx
try changing your code like this:
changes: made 'data' and 'leg' flat variables instead of arrays, changed comma to semicolon toward end of loop.
$row[0] and $row[1] are going to be the first and second columns in your table respectively...make sure that is the data you want to pull, otherwise call the columns by their associative name, such as $row['column_name'].
php Syntax (Toggle Plain Text)
while($row = mysql_fetch_array($resultmoto)) { $data = $row[1]; $leg = $row[0]; $chart [ 'chart_data' ][ 0 ][ $bar ] = $data; $chart [ 'chart_data' ][ $row ][ $bar ] = $leg; $bar++; }
changes: made 'data' and 'leg' flat variables instead of arrays, changed comma to semicolon toward end of loop.
$row[0] and $row[1] are going to be the first and second columns in your table respectively...make sure that is the data you want to pull, otherwise call the columns by their associative name, such as $row['column_name'].
The End
![]() |
Other Threads in the PHP Forum
- Previous Thread: Any keyword to break or continue a LOOP like as in C "break","continue" keawords??
- Next Thread: Email in php
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





