/    Sign up×
Community /Pin to ProfileBookmark

flash mx to PHP to flash mx

ok here’s the problem im trying to get my flash mx search form to search my MySql database using PHP….example go to [url]http://www.nightspotz.com[/url] 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 on the search button sends var to PHP——-

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 = “”;
}

——–the PHP script ——–

<?
/*change variables from flash mx to post*/
$venuename = $_POST[‘venuename’];
$phonenumber = $_
POST[‘phonenumber’];
$areacode = $_POST[‘areacode’];
$address = $_
POST[‘address’];
$city = $_POST[‘city’];
$state = $_
POST[‘state’];

/* mysql connection*/
$username=”nigolmvc_nigolmv”;
$password=”oscarlm4675″;
$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();

/*back to flash mx*/
$i=0;
while ($i < $num) {

$venuename=mysql_result($result,$i,”venuename”);
$areacode=mysql_result($result,$i,”areacode”);
$phonenumber=mysql_result($result,$i,”phonenumber”);
$address=mysql_result($result,$i,”address”);
$state=mysql_result($result,$i,”state”);
$city=mysql_result($result,$i,”city”);

echo “&venuename=”.$venuename.”&address=”.$address.”&areacode=”.$areacode.”&phonenumber=”.$phonenumber;

$i++;
}

?>

———script in flash mx that returns search results——-

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[“city”+i].text = this[“state”+i]
this.ref[“zipcode”+i].text = this[“zipcode”+i]
this.ref[“areacode”+i].text = this[“areacode”+i]
this.ref[“phonenumber”+i].text = this[“phonenumber”+i]

}
} else trace(“Error loading data”)

}
stop()

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @olm75 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...