this might not be the best solution 🙂
$q =select id from table
$idArray = Array();
$index = 0;
while(odbc_fect_row($q))
{
$idArray[$index] = odbc_result($q,1);
$index.++;
}
$list = "";
for($i=0;$i < 4;$i++)
{
$foo = rand(0,count($idArray));
$list = $list.$idArray[$foo],;
}
$q2 = select * from table where id IN (substr($list,0,strlen($list)-1)) // -1 removes last comma
....