$v = mysql_query("select * from `download` ;"); $c = mysql_num_rows($v); $num = rand(0, ($c - 1)); $req = mysql_query("SELECT `id`,`name`,`screen` FROM `download` where `type` = 'file' LIMIT " . $num . ", 1;"); while ($arr = mysql_fetch_array($req)){ echo"".$arr["; echo "$arr[name]"; }