phillyrob Posted July 6, 2008 Share Posted July 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted July 6, 2008 Share Posted July 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
phillyrob Posted July 7, 2008 Author Share Posted July 7, 2008 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. Quote Link to comment Share on other sites More sharing options...
marcus Posted July 7, 2008 Share Posted July 7, 2008 How are you attempting to make the music play? Flash MP3 Player? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 7, 2008 Share Posted July 7, 2008 your logic is off to my knowledge properly rowing helps. <?php while($row=mysql_fetch_array($result)) { $row['whatever']; } ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted July 7, 2008 Share Posted July 7, 2008 No, what he's doing is fine. Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted July 7, 2008 Share Posted July 7, 2008 your logic is off to my knowledge properly rowing helps. <?php while($row=mysql_fetch_array($result)) { $row['whatever']; } ?> that'd only be if he expected more than one result Quote Link to comment Share on other sites More sharing options...
corbin Posted July 7, 2008 Share Posted July 7, 2008 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; ? Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted July 7, 2008 Share Posted July 7, 2008 Not if the song name inputted ($_POST['Song']) is finding something like a song name, and then grabbing something like the code for the song $row['Song']. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.