Jump to content


Photo

SQL Error : 1054


  • Please log in to reply
2 replies to this topic

#1 AncientSage

AncientSage
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 12 September 2006 - 11:33 PM

I'm attempting to use this query via PHP:

"SELECT song_name, song_author, song_genre   
 FROM jukebox 
 WHERE " . $song_selected . " = song_filename"; //Note, this line.

All good up 'till that last line, I tried switching it around (where the variable is) and such, but it keeps telling me unknown column, or SQL Error 1054.

Now, I'm not too familiar with the WHERE clause, but if I want to tell SQL only to select results based on a row in song_filename, how would I do that with the WHERE clause? 'cause my method doesn't appear to be working.



#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 12 September 2006 - 11:53 PM

The $song_selected string should be surrounding by quotes

"SELECT song_name, song_author, song_genre   
 FROM jukebox 
 WHERE '" . $song_selected . "' = song_filename";



#3 AncientSage

AncientSage
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 12 September 2006 - 11:58 PM

I always miss something so simple. >.<

Anyway, thanks for the help.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users