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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.