# MYSQL ---\> PHP ---\> AS3 (Need help with little code)

**URL:** https://forum.kirupa.com/t/mysql-php-as3-need-help-with-little-code/289850
**Category:** Uncategorized
**Created:** [June 5, 2009, 3:46pm UTC](https://forum.kirupa.com/t/mysql-php-as3-need-help-with-little-code/289850 "2009-06-05T15:46:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Snivvle](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Snivvle](https://forum.kirupa.com/u/Snivvle)
#### Post date: [June 5, 2009, 3:46pm UTC](https://forum.kirupa.com/t/mysql-php-as3-need-help-with-little-code/289850/1 "2009-06-05T15:46:51Z")

</div>

Hi everyone,

For those of you who are familiar with sending information from MYSQL to PHP and then to AS3, I need some help. Basically I have a MYSQL Table with [COLOR=“YellowGreen”]3 names[/COLOR] in it, all on the first row. All I want to do is have PHP grab what is on the first row (which I can do), and then have AS3 grab that same info from PHP. I can currently do this, however rather than AS3 displaying the [COLOR=“YellowGreen”]3 names[/COLOR], it comes back with the row label as well, called “firstname”. So it comes back with “firstname=Mikefirstname=Jamesfirstname=Rob” I simply want it to come back with MikeJamesRob. Confused yet? :hr:

Here is the PHP code. The loop retrieves the [COLOR=“YellowGreen”]3 names[/COLOR] from the MYSQL Database, and I make the variable $returnVars EQUAL what it comes back with, so that I can send it back to AS3.

PHP CODE:

```php
<?php
// Make a MySQL Connection
include_once "connect_to_mysql.php";
// Get all the data from the "members" table
$result = mysql_query("SELECT * FROM members") 
or die(mysql_error());  
// Make a while loop to fetch all of the data from the table
while($row = mysql_fetch_array( $result )) {
// Make the returnVars string for AS3(flash)
$returnVars['firstname'] = $row['firstname'];
$returnString = http_build_query($returnVars);
// Display the information for AS3 to retrieve
echo $returnString;
}
?>

```

For the AS3 code I am leaving out the methods to retrieve the data. It works. I am just showing you how I am calling the variable through “firstname”.  
AS3 CODE:

```auto
var username = event.target.data.firstname;
textBox.text = username;

```

After all of this, textBox.text displays this:  
firstname=Mikefirstname=Jamesfirstname=Rob
