# Variables from mysql not showing in flash

**URL:** https://forum.kirupa.com/t/variables-from-mysql-not-showing-in-flash/330457
**Category:** Uncategorized
**Created:** [January 24, 2013, 7:51pm UTC](https://forum.kirupa.com/t/variables-from-mysql-not-showing-in-flash/330457 "2013-01-24T19:51:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chargerfan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@chargerfan](https://forum.kirupa.com/u/chargerfan)
#### Post date: [January 24, 2013, 7:51pm UTC](https://forum.kirupa.com/t/variables-from-mysql-not-showing-in-flash/330457/1 "2013-01-24T19:51:26Z")

</div>

Hoping someone has a solution to what I think may be a simple problem. I am just trying to get variable from a mysql database to show in Flash for testing purposes, but with no success. I have looked all over (including this forum) for solutions but no luck. The php file works for sure because I just went straight to the php file in the url and the result shows up, so I don’t think the problem is there. And I was able to insert variables into mysql via php with no problem on some other files I have created. Anyway, here is the php:

\<?php  
include(“config.php”);  
$sql = mysql\_query(“SELECT \* FROM scores ORDER BY uid DESC”);  
$row = mysql\_fetch\_array($sql);  
$name = $row[“name”];  
mysql\_free\_result($sql);  
mysql\_close();  
print “var1=$name is in database.”;  
?\>

And here is the actionscript. :

Bttn.addEventListener(MouseEvent.CLICK, getData);  
function getData(e:MouseEvent):void{  
var varSend:URLRequest = new URLRequest(“[http://www.mysite.com/test/getresults.php](http://www.mysite.com/test/getresults.php)”);  
varSend.method = URLRequestMethod.POST;

var varLoader:URLLoader = new URLLoader;  
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;  
varLoader.addEventListener(Event.COMPLETE, completeHandler);

varLoader.load(varSend);

function completeHandler(event:Event):void{  
var phpVar= event.target.data.var1;  
//print out result in text field with instance name of mText  
mText.text = phpVar;  
}  
}

I just have a feeling the solution is very simple and I have just overlooked it.  
Any help would be greatly appreciated.
