Jump to content

Can't get song to play when pulling from database


phillyrob

Recommended Posts

I have an interesting issue. When I manually type a url-encoded song title and echo it, it will play in my flash song player using AS2, but when I pull the song title from the database and echo it in the same format it won't play. The name of the song is "As" by Stevie Wonder. When I manually type it in like this: echo "&title=As&"; It echos to the screen in just that format, and I can pick it up as a variable in Actionscript 2 and play it. But when I do it like this:

 

$string2 = $_POST['Song'];

 

$rs2 = mysql_query("SELECT * FROM mymusic where song = '$string2'");

$row2 = mysql_fetch_array($rs2);

$sng = $row2['Song'];

 

echo "&title=$sng&"

 

it echos to the screen fine, and in the exact format as the manual echo, but it won't play. does anyone have any ideas as to why

Link to comment
Share on other sites

test to make sure the mysql query is getting what it needs to. If you have phpmyadmin, run that querty, and insert As where you have $string2 and see if any rows pop up. It could be the format of your data in the database.

 

 

Fake edit: I see your problem. You're saying "Look in my database where the column name is 'song' and find 'As'. And then when you're trying to get the variable after mysql_fetch_array, you're telling it "give me the array variable where the column name is 'Song'. That capital S and lowercase s is the difference maker. Check which case your 'song' column is and make them identical

Link to comment
Share on other sites

Thanks, but I have tried it multiple ways including changing upper and lower case. Again it echoes and post from the database to the screen exactly as needed and the exact same as when I manually put it in, but it will not play. Thanks again though.

Link to comment
Share on other sites

Can you show us the entire code?  (The entire PHP file)

 

The seems to be somewhere else.

 

 

Also, why are you pulling a column equal to a value?

 

I'm pretty sure MySQL columns are case-insensitive, so why would you pull a column equal to a value and then echo it?

 

$rs2 = mysql_query("SELECT * FROM mymusic where song = '$string2'");

$row2 = mysql_fetch_array($rs2);

$sng = $row2['Song'];

 

Isn't that the same as just doing

 

echo $string2;

 

?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.