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

**URL:** <https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/102202>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 8:57pm UTC](https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/102202 "2004-02-20T20:57:04Z")\
**Posts on this page:** 3\
**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/102202/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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 4:45pm UTC](https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/102202/2 "2004-02-21T16:45:58Z")

</div>

This is a great post jollup because I am having the same issue. I can pass a variable into Flash from PHP but only into a dynamic text box. I want to be able to manipulate the variable just like you do. I am trying everything to do it. If you find something please send me a message I will notify you if I find anything helpful. Thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 5:31pm UTC](https://forum.kirupa.com/t/mx-working-with-loadvars-from-php-in-flash/102202/3 "2004-02-21T17:31:58Z")

</div>

don’t know if I understand your problems correct. but you have a string that you want to be a number,

check your dictionary for something called Number()  
it converts a string to a number.
