# Display a variable in FLASH using LoadVars and PHP

**URL:** <https://forum.kirupa.com/t/display-a-variable-in-flash-using-loadvars-and-php/101220>\
**Category:** Uncategorized\
**Created:** [February 7, 2004, 9:01am UTC](https://forum.kirupa.com/t/display-a-variable-in-flash-using-loadvars-and-php/101220 "2004-02-07T09:01:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jajoho](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jajoho](https://forum.kirupa.com/u/jajoho)\
**Post date:** [February 7, 2004, 9:01am UTC](https://forum.kirupa.com/t/display-a-variable-in-flash-using-loadvars-and-php/101220/1 "2004-02-07T09:01:59Z")

</div>

What I’m trying to do:

Send a user input to PHP  
Use this input to query a MySQL DB (This works fine)

Get the result back to Flash and put it in a dynamic Text Box - How???

The communication from Flash to PHP works fine. The variable I pass from Flash to PHP are used in the query as intended.

Then Im trying to send a variable back to flash. I cant display this variable in Flash, only in a new explorer window…

\<?php

require ‘Include.php’; //Data about $DBhost,$DBuser,$DBpass  
$user=$\_GET[‘name’];

// Connects to the database.  
mysql\_connect($DBhost,$DBuser,$DBpass);  
mysql\_select\_db("$DBName");

// The SQL query.  
$query = “SELECT \* FROM $table WHERE user =’$user’” ;  
$result = mysql\_query($query);

/\* This just gets the number of rows in the Query \*/  
$numR = mysql\_num\_rows($result);

// If the number of rows is 0–\> no hits on query  
if ($numR\>0) {  
for($i=0; $i \< $numR; $i++) {  
$row = mysql\_fetch\_array($result);  
print $row[‘fname’]; //This prints ‘Bruno’ when user = ‘test’  
}  
}  
else {  
print "not connected ";  
}  
?\>

* * *

Actionsript:

on (release) {  
var my\_vars = new LoadVars();  
//Get the text from Input Text  
my\_vars.name=userName.text;

```
//Send input (my_vars) to PHP and assign result to my_vars
my_vars.send("http://localhost/lms/Login.php",my_vars,"POST");

//Set the result in Dynamic Text box with Var name status
status=my_vars.name;

```

}

* * *

I’ve read all the tutorials I was able to find, looked at the macromedia site, and still not able to solve it.

This problem has been driving me crazy for one week now. I scanned through this forum, but haven’t found anything useful for my case.

Hoping for replies, best regards  
Jarle
