# (php,MySQL) set multiple variables in Flash with one query/call to php?!

**URL:** <https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367>\
**Category:** programming\
**Created:** [April 4, 2006, 5:39pm UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367 "2006-04-04T17:39:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mawooshen](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@mawooshen](https://forum.kirupa.com/u/mawooshen)\
**Post date:** [April 4, 2006, 5:39pm UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/1 "2006-04-04T17:39:00Z")

</div>

Hi,

Is it possible to set the value of a number of variables in Flash by using just one call to php and MySQL?

I want to collect 16 or so values from a MySQL database and place them in seperate variables in Flash. Thanks to a couple of tutorials on this site, I’ve managed to do it but I’m looping the same call to a php file lots of times to get each individual value. It seems a clumsy way to do things when one query should be enough.

Can anyone tell me how I might go about getting values for multiple variables with just one call to a php script and one database query?

Cheers!

---

<div class="post-metadata">

**Author:** ![bwh2](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@bwh2](https://forum.kirupa.com/u/bwh2)\
**Post date:** [April 4, 2006, 6:04pm UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/2 "2006-04-04T18:04:03Z")

</div>

sounds like you need to return an array from your mysql query.

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 4, 2006, 6:08pm UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/3 "2006-04-04T18:08:02Z")

</div>

well, it’s would be a good start if you give some more info wfor us to work with, post your Actionscript that has the loadvars and also the corresponding PHP code.

for as tags, use [as]&[/as] (without spaces)  
for php tags, use [php]&[/php] (without spaces)

---

<div class="post-metadata">

**Author:** ![bwh2](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@bwh2](https://forum.kirupa.com/u/bwh2)\
**Post date:** [April 4, 2006, 6:10pm UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/4 "2006-04-04T18:10:44Z")

</div>

giving the table structure would also help as well.

---

<div class="post-metadata">

**Author:** ![mawooshen](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@mawooshen](https://forum.kirupa.com/u/mawooshen)\
**Post date:** [April 5, 2006, 2:47am UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/5 "2006-04-05T02:47:57Z")

</div>

…arrays, of course that’s what those pesky things are for.

Found the perfect tutorial right here at Kirupa:

[http://www.kirupa.com/developer/mx2004/external\_array.htm](http://www.kirupa.com/developer/mx2004/external_array.htm)

to expand on my problem now that I’ve solved it, the php and MySQL side of things wasn’t an issue, I was just confused how I could return multiple variables when Flash always interpreted whatever the php returned as one long string. Turns out sticking this value in an array in as and using split(","); will do the trick.

cheers for the replies

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 5, 2006, 2:49am UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/6 "2006-04-05T02:49:53Z")

</div>

or formatting it cleanly in the string

---

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [April 5, 2006, 4:40am UTC](https://forum.kirupa.com/t/php-mysql-set-multiple-variables-in-flash-with-one-query-call-to-php/184367/7 "2006-04-05T04:40:15Z")

</div>

Yeah, just build xml with your php query and then import the xml to your flash. Then set your variables to the node values or node attributes. Not that hard and there are a lot of tutorials out there on it;)
