Here's the code I'm using:
$q = "SELECT COUNT(*) FROM quotes";
$num = mysql_query($q) or die(mysql_error());
if($num){
$skip = round(rand(0,$num - 1));
echo $skip;
}
The table in question has only one row in it. However, it had a few more in the past. The problem is that the above code wil return various values for $skip ranging from 0 all the way to 6 or 7. I tried echoing $num and I get "Resource id #7" and not 1 as expected.
Can anyone point me in the proper direction?