ive got a database full of quotes which i want to display one of at random, but i'm having some troubles. heres my code:
$query = "select quote from quotes";
$result = mysql_query($query);
while ($quote = mysql_fetch_assoc($result))
{
$sizeofarray = count($quote)
or die("sizeofarrayerror");
echo("size $sizeofarray");
$randomnumber = mt_rand('0','$sizeofarray')
or die("randomNumberError");
echo("rand $randomnumber");
echo("$quote[$randomnumber]")
or die("quoteError");
}
the above code echoes that the size of the array is 1 (when there's 9 rows in the db), which messes up the $randomnumber, which messes up the echo($quote[$randomnumber])
any ideas on what the problem could be???
~JOSH