Forum Moderators: coopster
$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>";
}
$songquery="SELECT * from db WHERE lyrics !='NONE'";
$songqueryresult=mysql_query($songquery);
while($songrowdata=mysql_fetch_array($songqueryresult))
{ $song=$songrowdata['song'];
$artist=$songrowdata['artist'];
$lyrics=$songrowdata['lyrics'];
$songs[]="".$song."<br />".$artist."<br /><a href='http://www.sample.com/".$lyrics."'>Lyrics</a>";
srand((double) microtime() * 1000000);
$randomsong=rand(0, (count($songs)-1));
echo "<p>".$songs[$randomsong]."</p>";
}
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).