Jump to content

PHP charts


kevincro

Recommended Posts

My first question is, has anyone used a PHP/SWF charts before, and if so have you had any problems with it.  My second question is, is there anything wrong with the following code.  I'm trying to set up an array that will populate a flash chart with database info.

 

$data_key = $_GET['item_id'];
include "charts.php";
//start the PHP multi-dimensional array and create the region titles
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Number $data_key ";

require "db_connect.php";
//get the smallest year to determine which year to start the chart with
$result = mysql_query("SELECT MIN(game) AS MinGame FROM bankroll WHERE number = '$data_key'");
$MinGame = mysql_result ( $result, 0, "MinGame" );

//get all the data in the Growth table
$result = mysql_query ("SELECT * FROM bankroll WHERE number = '$data_key'");

//extract the data from the query result one row at a time
for ( $i=0; $i < mysql_num_rows($result); $i++ ) {

   //determine which row in the PHP array the current data belongs to
   switch ( mysql_result ( $result, $i, "number" ) ) {
      case " Number $data_Key ":
      $row = 1;
      
      break;

   }

   //determine which column in the PHP array the current data belongs to
   $col = mysql_result ( $result, $i, "game") - $MinGame + 1;

   //populate the PHP array with the game title
   $chart [ 'chart_data' ][ 0 ][ $col ] = mysql_result ( $result, $i, "game");

   //populate the PHP array with the bank data
   $chart [ 'chart_data' ][ $row ][ $col ] = mysql_result ( $result, $i, "Bank");
}

Link to comment
https://forums.phpfreaks.com/topic/98168-php-charts/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.