Hi guys. Please help me. I’ve been dealing with this problem for almost a week now. I can’t seem to find the solution. Just a newbie in AS3 and trying to pass data from mysql to flash. Here’s my code.
[COLOR=“red”]AS3 CODE[/COLOR]
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.utils.Timer;
click_btn.addEventListener(MouseEvent.CLICK,doThisStuff);
function doThisStuff(e:Event){
var myVariable:URLVariables = new URLVariables;
myVariable.pass = pass_txt.text;
var myRequest:URLRequest = new URLRequest("http://localhost/simple-passing.php");
myRequest.method = URLRequestMethod.POST;
myRequest.data = myVariable;
var myLoader:URLLoader = new URLLoader;
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
myLoader.load(myRequest);
myLoader.addEventListener(Event.COMPLETE,displayMe);
}
function displayMe(e:Event){
if(e.target.data.passMe==""){
get_txt.text=“No data coming thru.”;
}
else{
get_txt.text=get_txt.text+"
"+e.target.data.passId;
}
}
[COLOR=“red”]PHP-CODE[/COLOR]
<?php
require_once"establish-connection.php";
$getVar=$_POST[‘pass’];
$getVar=“Bill”;
$myquery = mysql_query(“SELECT * FROM chats WHERE user_name=’$getVar’”);
while($row=mysql_fetch_array($myquery)){
$getId = $row[‘id’];
}
echo “passId=”.$getId;
?>