PDA

View Full Version : mysql,php,flash


DocFirestorm
02-10-2002, 01:03 PM
Hey!

I have a question about getting the results from a query into my flash movie.

the code:

$sql = "SELECT * FROM table LIMIT 0,3 ORDER BY TIMESTAMP";
$result = mysql_query($sql);
while($row = mysql_fetch_object($result)
{
print (&message=$row->......);
}

if i extract the script without flash i get 3 results.

in flash im made loadvar.... and insertet in a textbox if the variable is loaded.

when i put the & away from the php code i get 3 result but like this test1message=test2message=test3

i tried it to split i up but i didnt work fine

thx

Jesse
02-11-2002, 05:35 AM
I'm not exactly sure what the problem is but bear in mind that flash can only read in strings, not objects. I tend to use mysql_fetch_array and then send back each item in the array:
echo "&var1=$row['var1']&var2=$row['var2']";
I know it's prolly more typing but it works. Also it's wise to add something like "&EOF=true" at the end of the string so you can tell when loading is complete.

DocFirestorm
02-11-2002, 06:19 AM
I allready fixed it. the problem was that my variable declaration was inside the while loop so made it like this

print("$message=")
while ($row=mysql_fetch_object....)
{
print("$row->......")
}