Im trying to get a random script working that displays 3 pictures from a group of 11, but when number 11 comes up its blank.
Can anyone have a look at the code and either advise how to optimise it?
$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 where CLIENT=$random ";
$result = mysql_query($special_sql);
while ($portfolio = mysql_fetch_array($result)) {
echo " <TR>";
echo " <TD align=middle> <BR>\n";
echo " <img src=http://www.phpbuilder.com/board/archive/index.php/\"img/screenshots/" . $portfolio["Image"] . "\" border=0 width=\"127\" height=\"126\">";
echo " </TD>";
echo " </TR>";
}
Can anyone have a look at the code and either advise how to optimise it?
$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 where CLIENT=$random ";
$result = mysql_query($special_sql);
while ($portfolio = mysql_fetch_array($result)) {
echo " <TR>";
echo " <TD align=middle> <BR>\n";
echo " <img src=http://www.phpbuilder.com/board/archive/index.php/\"img/screenshots/" . $portfolio["Image"] . "\" border=0 width=\"127\" height=\"126\">";
echo " </TD>";
echo " </TR>";
}