# Undefined variables in AS3 from PHP-MySQL

**URL:** https://forum.kirupa.com/t/undefined-variables-in-as3-from-php-mysql/323802
**Category:** flash
**Created:** [July 19, 2011, 2:58am UTC](https://forum.kirupa.com/t/undefined-variables-in-as3-from-php-mysql/323802 "2011-07-19T02:58:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chammie](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@chammie](https://forum.kirupa.com/u/chammie)
#### Post date: [July 19, 2011, 2:58am UTC](https://forum.kirupa.com/t/undefined-variables-in-as3-from-php-mysql/323802/1 "2011-07-19T02:58:27Z")

</div>

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;  
?\>
