I am building dynamic graphs using PHP mySQL and PHPObject.

I have setup a directory under the webroot called classes and told the Gateway.php to us that.

I have made my own class that will pull a record from my mySQL db.

I can't seem to understand what I am doing wrong. I can't tell if the class is getting invoked.

Is there a way I can trace the data when the swf is executed on the server?

Should I be naming my dynamic text vars a certain way?

I installed the PHPObject.mxp in flash. Does this mean that when the swf is generated the PHPObject.as is automatically included in the swf? Or do I have to send that file up to the server?

if you go to roisports.com/ROIChart.html
you can see that I have one graph that is supposed to use the data that PHPObject grabs.
There should be a number next to the dollar sign on the bottom graph. The other 2 graphs are loaded with static data.


PHP Code:

<?php class records 
function 
getrecord($getrecord
{
 
$db_name "roisport_ROICharts";
 
$connection = @mysql_connect("localhost""roisport""missalic") or die("Could not connect to database");
 
mysql_select_db($db_name$connection) or die("Count not select database");
 
$query "SELECT * FROM ROI_Data WHERE id = '$getrecord'"$q_result mysql_query($query); 
return 
mysql_fetch_row($q_result); 


?>
the file is called records.php

In my AS I have the following code

// import the library
#include "PHPObject.as"

// set up gateway url and key
_global.defaultGatewayUrl = "http://localhost/Gateway.php";
_global.defaultGatewayKey = "secret";

// creates the object
myFoo = new PHPObject("records");

// sets up responder
myFoo.getrecord_onResult = function(result)
{
id.text = result[0];
sport.text = result[1];
money.text = result[2];
gamedate.text = result[3];
win.text = result[4];
loss.text = result[5];
}


// invoke remote method passing in the recordid as parameter
myFoo.getrecord("3");



// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Show data output
// dollar amout that will be dynamic later on
m=money.text;
trace(money.text);
// domain of our graph is the total amount
total=1000;

// create color object for the bar and dollar sign and dynamic text
barColor = new Color (_root.ncaa_chart.bar);
dollarColor = new Color (_root.ncaa_chart.dollar_sign);

// set dText
_root.ncaa_chart.ncaa_amount=m;

// set color based on dollar amount
if (m>0) {
barColor.setRGB(0x468455);
dollarColor.setRGB(0x468455);
} else {
barColor.setRGB(0xCC0000);
dollarColor.setRGB(0xCC0000);
m=m*-1
}
// calculate percent that will be the width of the bar
percent=Math.round((m/total) * 100);

// set width of bar
_root.ncaa_chart.bar._width = 150*(percent / 100);