Display data from db to flash label
Hey guys,
I still can't get the data from mysql to the flash label after so many tries and research. I managed to read the data (from the db) from my php file. I don't think there's a problem with the php file..however, i think the problem came from the actionscript. I'm gonna post both below anyway just in case. Is it because i can't use label? Or i have to use textbox? I don't know, i'm a newbie in actionscript. So, please help!! Thanks!
php
<?php
include_once "dbconnect.php";
($_POST['systemCall'] == "checkWA");
$tbl_name = "info";
$result = "";
$sql = "SELECT wa1 FROM $tbl_name"; //column wa1 for 1 textbox
$query = mysql_query($sql) or die ("cannot access");
$wa_one = mysql_num_rows($query);
while ($data = mysql_fetch_array($query)) {
$wa_one = $data["wa1"];
$result = "$wa_one";
}
print $result;
?>
actionscript --> I believe the problem starts here
import flash.display.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequestMethod;
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("wa.php");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.TEXT;
phpLoader.addEventListener(Event.COMPLETE, showWa);
function showWa(event:Event):void
{
wa_info.autoSize = TextFieldAutoSize.LEFT;
if (event.target.data.result == "")
{
wa_info.text = "No Data";
}
else
{
wa_info.condenseWhite = true;
wa_info.text = "" + event.target.data.result;
}
}
phpVars.systemCall = "checkWA";
phpVars.wa_info = wa_info.text;
phpLoader.load(phpFileRequest);
