# Flash mx to PHP to flash mx

**URL:** <https://forum.kirupa.com/t/flash-mx-to-php-to-flash-mx/72774>\
**Category:** Uncategorized\
**Created:** [December 9, 2004, 4:29am UTC](https://forum.kirupa.com/t/flash-mx-to-php-to-flash-mx/72774 "2004-12-09T04:29:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![olm75](https://avatars.discourse-cdn.com/v4/letter/o/8c91f0/32.png) [@olm75](https://forum.kirupa.com/u/olm75)\
**Post date:** [December 9, 2004, 4:29am UTC](https://forum.kirupa.com/t/flash-mx-to-php-to-flash-mx/72774/1 "2004-12-09T04:29:58Z")

</div>

**flash to php to flash**  
ok here’s the problem im trying to get my flash mx search form to connect to my MySql database using PHP…example go to [[color=#22229c]http://www.nightspotz.com[/color]](http://www.nightspotz.com/) and go to search link…does not do anything when the submit button is hit…does anyone have any sample .fla that has a search from flash on it will be greatly appreciated…

---------script attached to button:

on (release) {  
myData = new LoadVars();  
myData.venuename = venuename.text;  
myData.state = state.getSelectedItem().label;  
myData.city = city.getSelectedItem().label;  
myData.areacode = areacode.text;  
myData.venuetype = venuetype.getSelectedItem().label;  
myData.agegroup = agegroup.getSelectedItem().label;  
myData.musictype = musictype.getSelectedItem().label;

myData.sendAndLoad(“search.php”, myData, “POST”);  
gotoAndPlay(results);  
venuename = “”;  
state = “”;  
city = “”;  
areacode = “”;  
venuetype = “”;  
agegroup = “”;  
musictype = “”;  
}

----------this is the PHP script:

\<?

/\* mysql connection\*/  
$username=“nigolmvc\_nigolmv”;  
$password="\*\*\*\*\*\*\*\*\*\*";  
$database=“nigolmvc\_nightspotz”;

mysql\_connect(localhost,$username,$password);  
@mysql\_select\_db($database) or die( “Unable to select database”);  
$query=“SELECT \* FROM venues WHERE `venuename` = ‘$venuename’ AND ‘areacode’ = ‘$areacode’  
AND ‘city’ = ‘$city’ AND ‘state’ = ‘$state’ AND ‘clubtype’ = ‘$clubtype’ AND ‘musictype’ = ‘$musictype’ AND ‘agegroup’ = ‘$crowd’ ORDER BY `venuename` ASC”, $colname\_searchRS;  
$result=mysql\_query($query);

$num=mysql\_numrows($result);

mysql\_close();

$i=0;  
while ($i \< $num) {

$venuename=mysql\_result($result,$i,“venuename”);  
$areacode=mysql\_result($result,$i,“areacode”);  
$phone=mysql\_result($result,$i,“phone”);  
$address=mysql\_result($result,$i,“address”);

echo “\<b\>$venuename\</b\>\<br\>$address\<br\>$city\<br\>$state $zipcode\<br\>$areacode $phonenumber\<br\>$email\<br\>$website\<br\>\<br\>$comments\<br\>\<hr\>\<br\>”;

$i++;  
}

-----here is the script from results .fla that should show results from PHP:

myData.load(“search.php”) //php line  
myData.ref = this  
//Fetch data  
myData.onLoad = function(succes){  
if(succes){  
for(var i=0; i\<this.cant; i++){  
this.ref[“venuename”+i].htmlText = “\<b\>”+this[“venuename”+i]+"\</b\>"  
this.ref[“address”+i].text = this[“address”+i]  
this.ref[“phonenumber”+i].text = this[“phonenumber”+i]

}  
} else trace(“Error loading data”)  
}  
stop()
