Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Random show from db from 3 fields


weddingm - 5:58 pm on Mar 9, 2011 (gmt 0)


I am creating a random song showing from db. I have the song, artist and lyrics in 3 different fields in same db. How do I put that in the array?


$songquery="SELECT * from songdb WHERE lyrics !='NONE'";
$songqueryresult=mysql_query($songquery);
while($songrowdata=mysql_fetch_array($songqueryresult))
{ $song=$songrowdata['song'];
$artist=$songrowdata['artist'];
$lyrics=$songrowdata['lyrics'];


$songs[] = $dbsongs

srand ((double) microtime() * 1000000);
$randomsong=rand((0,count($songs)-1);

echo "<p>" . $songs[$randomsong] . "</p>";
}


Thanks,
Matt


Thread source:: http://www.webmasterworld.com/php/4278994.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com