PDA

View Full Version : Flash variable to PHP, use variable to select records


PsychoSpike
02-14-2005, 04:34 PM
flash script: setting mydata.typestr = "shoot";
myData = new LoadVars()
//http://localhost/dreamx3me/
mydata.typestr = "shoot";
myData.sendAndLoad("http://localhost/dreamx3me/dbquerygames.php", myData, "POST");
myData.onLoad = function(succes){
if(succes){
aantal = count;
for(var i=0; i < count; i++){
imagearray[i+1]= this["picture"+i];
textmsgarray[i+1]=this["textmsg"+i];
trace("i " + i+ "= "+this["textmsg"+i])
trace("i " + i+ "= "+this["picture"+i]);
}
} else trace ("Error loading data")
}

<?php
$choice = $_POST['typestr'];
mysql_connect("localhost","*****","****");
mysql_select_db("dreamx3me");

$result = mysql_query("SELECT `textmsg`,`picture`,`swfname` FROM `games` WHERE 1 AND `type` LIKE 'fight' ORDER BY `id` ASC LIMIT 0, 30");
$cant =0;
while($row=mysql_fetch_array($result)){
echo "textmsg$cant=$row[textmsg]&picture$cant=$row[picture]&swfname$cant=$row[swfname]&";
$cant++;
}
echo "cant=$cant&";
?>

how do i put the chosen parameter $choice = which should be "shoot"
into $result = mysql_query("SELECT `textmsg`,`picture`,`swfname` FROM `games` WHERE 1 AND `type` LIKE ????????? ORDER BY `id` ASC LIMIT 0, 30");

because i don't get the required results after a lot of testing... i am so noobie in php... very sry

thx in advance

PsychoSpike
02-15-2005, 02:18 PM
problem solved