# \[mx\] working with loadVars from PHP, in Flash

**URL:** <https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/43301>\
**Category:** flash\
**Created:** [February 20, 2004, 8:57pm UTC](https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/43301 "2004-02-20T20:57:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jollup](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jollup](https://forum.kirupa.com/u/jollup)\
**Post date:** [February 20, 2004, 8:57pm UTC](https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/43301/1 "2004-02-20T20:57:04Z")

</div>

I looked at the tutorial section to see how to get loadVars to load in data from PHP.  
PHP code:  
//do league queries  
$query\_mteam = “SELECT name FROM test ORDER BY name ASC”;  
$mteam = mysql\_query($query\_mteam) or die(mysql\_error());  
$row\_mteam = mysql\_fetch\_assoc($mteam);  
$num\_rows = mysql\_num\_rows($mteam);  
$message=“hi there”;  
echo “&rows=”.$num\_rows;

Resulting code in flash:  
loadText = new LoadVars();  
loadText.load(“test.php”);  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
totalBox.html = true;  
totalBox.htmlText = this.rows;  
**var newrows=this.rows;**  
}  
};  
Now I added the extra line in bold as I need to be able to use the variable I have grabbed from my PHP file using the above code (the var is called rows) and I need to be able to use this figuree to do some simple math… but I can’t seem to get it to do anything apart from appear in text fields…

I want to be able to do:  
row=row+5;  
for example. In fact, I want to use the value of row to generate a certain number of buttons dynamically. This eventually will be a menu based on values from a database (mySQL and PHP) but I am stumbling at the first hurdle.

Any help here?
