Im trying to get a random 3 images from 11 entries. This script works OK apart from well it pulls 11 up as the final entry, where it then causes an error.
Can anyone suggest a better way of doing it or where my code itself could be improved?
$count_sql = \"select * from portfolio\";
$cresult = mysql_query($count_sql);
$count = mysql_num_rows($cresult);
// seed with microseconds since last \"whole\" second
srand((double)microtime()*1000000);
$random=(rand (1,$count));
$special_sql = \"select * from portfolio order by $random limit 3 \";
$result = mysql_query($special_sql);
while ($portfolio = mysql_fetch_array($result)) {
echo \" <TR>\";
echo \" <TD align=middle> <BR>\n\";
echo \" <img src=\\"img/screenshots/\" . $portfolio[\"Image\"] . \"\\" border=0 width=\\"127\\" height=\\"126\\">\";
echo \" </TD>\";
echo \" </TR>\";
}