xshanelarsonx Posted February 12, 2007 Share Posted February 12, 2007 I'm trying to randomly pick a row from a mysql table and display it's info. I keep getting a error on line 2. $Music="SELECT * from songs ORDER BY RND() LIMIT 1"; $Music_Result=mysql_query($Music); while ($row=mysql_fetch_array($Music_Result)) { $SongNameRandom=$row["SongName"]; $FileRandom=$row["File"]; } Link to comment https://forums.phpfreaks.com/topic/38102-solved-mysql-problem/ Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 It helps to know which line is six. The mysql keyword is rand, not rnd. $Music_Result=mysql_query($Music) or die(mysql_error()); would give you a better error. Link to comment https://forums.phpfreaks.com/topic/38102-solved-mysql-problem/#findComment-182411 Share on other sites More sharing options...
The Little Guy Posted February 12, 2007 Share Posted February 12, 2007 Its RAND, not RND Link to comment https://forums.phpfreaks.com/topic/38102-solved-mysql-problem/#findComment-182415 Share on other sites More sharing options...
xshanelarsonx Posted February 12, 2007 Author Share Posted February 12, 2007 Its RAND, not RND Thank you, this fixed it. Thanks Jesirose for pointing that out. For now on I'll tell what row it is with that code, I was using the whole page when it told me that row. LOL Link to comment https://forums.phpfreaks.com/topic/38102-solved-mysql-problem/#findComment-182419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.