I would like to be able to select my most recent three rows, and then have PHP randomly select one of the id's each time the page is refreshed. I think this is about how it would be done, but it is not working.
$result =("Select * from table order by date DESC LIMIT 3");
$numres=mysql_num_rows($result);
$i=0;
while ($i>0)
{
$obj=mysql_fetch_object($result);
$id = $obj->id;
$number=array($id[0], $id[1], $id[2]);
$number2=array_rand($number);
$i++
}
if ($id==$number2)
{
print etc etc;
Am I way off, or am I just missing something?