3rdeye
September 12, 2004, 5:56am
1
I’m sending a series of integers from Flash using sendAndLoad, simmilar to:
infoSend.imageTotal = 3
infoSend.imageNum1 = 435
infoSend.imageNum2 = 45
infoSend.imageNum3 = 9
infoSend.sendAndLoad(“http…”, infoLoad, “POST”);
my question is, how do I parse the data on the PHP side?
right now I have a while loop
while( $i <= $imageTotal){
[color=Red] $tempID = $imageNum[$i];[/color]
$result = mysql_query(‘SELECT * FROM tbl_mov WHERE movID=’.$tempID.’’,$dbcnx);
$data = mysql_fetch_array($result);
$str = $data[‘img_thumb’];
echo ‘&imgID=’.$i;
echo ‘&imgLoc=’.$str;
$i++;
};
the line in red is the only one I know isn’t working… anyone know how to structure it?
system
September 12, 2004, 6:54am
2
I suggest using $_POST[’’]; on all the variables that were sent from flash
e.g. $_POST[‘imageTotal’];
and for the tempID part. I can only say that u need eval(); Right now you’re tryng to get the $i-th member of the “imageNum” array but you have variables.
http://www.php.net/eval
I haven’t used eval much so I can’t give u the right code :to:
system
September 12, 2004, 7:14am
3
I found the answer, basically called variable variables, link here:
http://php.he.net/manual/en/language.variables.variable.php
what I did was:
while( $i <= $imageTotal){
[color=Red] $tempStr = ‘$imageNum’.$i;
$tempID = ${$tempStr};[/color]
$result = mysql_query(‘SELECT * FROM tbl_mov WHERE movID=’.$tempID.’’,$dbcnx);
$data = mysql_fetch_array($result);
$str = $data[‘img_thumb’];
echo ‘&imgID=’.$i;
echo ‘&imgLoc=’.$str;
$i++;
};