So hi people,
I have a small question and very needed to be explained

I want to randomly pick an id out of a table so I wrote this
Code:
$allids = $DB_site->query("SELECT id FROM " . TABLE_PREFIX . "test");
$idarray = array();
while ($ids = $DB_site->fetch_array($allids))
{
$idarray[] .= $ids['id'];
}
$id = array_rand($idarray);
But it didn't work, I know my PHP and SQL skill still bad so I really need some support now. Thanks in advanced.