PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi guyz,
I got a little problem with sending variables to flash. I've done some reading and i got the hang of it when there is a constant variable, however if i need to get something from the DB and send that to flash then it doesn't work..
<?php
$var='mymusic.mp3';
$echo("audio=$var&");
?>
Here a little example of what doesn't work: :(
<?php
$var=$dbname . '.mp3';
$echo("audio=$var&");
?>
Anyone got a clue of why i can't use variables from php to flash? I've tried just about everything..
Thanks...
Last edited by dreamline on Tue Jan 11, 2005 8:20 pm, edited 1 time in total.
Hi guyz,
Well i am working on an mp3 player that gets the name of the files from a database, so what happens is that through sql i grab the name from the database and put it in $dbname. So $dbname contains the name of the file to be played.. Let's say the file i wanna play is mymusic.mp3.
The code speaks imho for itself:
If i hard code the name of the file to be played in $var then the music plays perfectly... If i substitute the hardcode for a variable then it won't play at all, not even a sound..
Last edited by dreamline on Mon Jan 10, 2005 11:57 pm, edited 5 times in total.
<?php
$query="select * from songs where nummer = $nummer";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$dbname=$rowї'filename'];
?>
Ive done that and echo $var on screen.. And $dbname shows me the exact same name as if i hardcode it.. In this case mymusic.mp3. But Flash doesn't pick it up unless i hardcode the name.. And that's weird..
if I use a php variable in the echo command then it just doesn't work..
your just missing something. there should be no difference whether you echo a variable or a hardcoded string.
look at the difference in output between what works and what doesnt. there has to be a difference, otherwise both ways will work.
make sure your not misspelling variables.
I was indeed missing something.. I loaded a php file on startup of the .swf file, but when i user vars in the url everything works smoothly.. I am a n00b when it comes to flash... LOL...
Thanks for pointing me all in the right direction guyz..