PHP variable into Flash?

Hi!

I’ve got a problem with getting a PHP-variable into Flash with AS3. I haven’t done much AS3 programing but I know how to send variables, however this time I just want retrieve 1 from PHP(with a value from a MySQL database) into a textInput in Flash.

I’ve tried different tutorials but nothing seems to work for me.
This is my PHP script:

//this line is the call from flash, don’t know if it’s correct.
if ($_POST[‘getDataRequest’] == “getBmr” ){

$uid = $_SESSION['uid'];
$bmr = $_POST['bmr'];
$uid = 1;

$query = "SELECT bmr FROM tblBmr WHERE uid='" . $uid . "' ORDER

BY DATE DESC LIMIT 0,1";
print_r($query);
$result_set = mysql_query($query);
confirm_query($result_set);

while ($row = mysql_fetch_assoc($result_set)) {

//I get the correct value when i echo this so i'm doing something right
echo $row['bmr'];

$bmrValue = $row['bmr'];

//from what i've seen in tutorials, this is what flash will retrieve:
print "bmr="$bmrValue; 

//but i can't get it to work

}
}

This is my AS3, don’t know if it’s correct either :slight_smile: :

function getBmrNr(e:MouseEvent):void {

var getBmrDB:URLVariables = new URLVariables();

var phpBurn:String = “http://www.mysite.com/flashData.php”;

var getBmrDB_send:URLRequest = new URLRequest(phpBurn);
getBmrDB_send.method = URLRequestMethod.POST;
getBmrDB_send.data = getBmrDB;

var getBmrDB_varLoader:URLLoader = new URLLoader;
getBmrDB_varLoader.dataFormat = URLLoaderDataFormat.TEXT;
getBmrDB_varLoader.addEventListener(Event.COMPLETE, recievingData);

    getBmrDB.getDataRequest = "getBmr";
    getBmrDB_varLoader.load(getBmrDB_send);

function recievingData(e:Event):void{

var phpVar1 = e.target.data.bmr;
bmrField.text = phpVar1;   
}

}

minField.addEventListener(MouseEvent.CLICK, getBmrNr);

Would be VERY thankful for any help, it’s a college group project…
I’ll get my a** kicked if I don’t deliver :slight_smile:

Cheers,

Hacee