# Loading Var from Php to flash

**URL:** https://forum.kirupa.com/t/loading-var-from-php-to-flash/48848
**Category:** flash
**Created:** [April 17, 2004, 11:08am UTC](https://forum.kirupa.com/t/loading-var-from-php-to-flash/48848 "2004-04-17T11:08:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![beforedawn](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@beforedawn](https://forum.kirupa.com/u/beforedawn)
#### Post date: [April 17, 2004, 11:08am UTC](https://forum.kirupa.com/t/loading-var-from-php-to-flash/48848/1 "2004-04-17T11:08:54Z")

</div>

Hi,

I am flash newbie and I am trying load a variable from php to flash, I have looked around on this and other forums and this seems like the right code but no luck thus far.

here is my actionscript:

myLoadVar = new LoadVars();  
myLoadVars.load(“loadImages.php”);  
myLoadVars.onLoad = function (success) {  
// If the data loads, display the variable in a  
// text field named output\_txt on \_root.  
if (success) {  
\_root.output\_txt.text = this.photoId;  
}  
};

my php:

$db = new Database();  
//load Image  
$query = "SELECT ID FROM PHOTO ";  
$result = $db-\>query($query);

$item;

while($row = mysql\_fetch\_object($result))  
{  
$item = $row-\>ID;  
}  
echo “photoId=”.$item."";

when i run the php I get an output but the flash is not displaying anything.  
I have enclosed the fla file aswell, just in case I am doing something really stupid.

any help you could give me on this would be most appreciated.

thanks

ash
