$rth=$dbh->prepare("select max(id) from zen order by id") or die("Can't connect: ", $dbh->errstr); $rth->execute; $id=$rth->fetchrow_array; $selid=int(rand($id)+1); $tth=$dbh->prepare("select koan from zen where id=$selid") or die("Can't connect: ",$dbh->errstr); $tth->execute; $koan = $tth->fetchrow_array; #### $tth=$dbh->prepare("select koan from zen order by rand() limit 1") or die("Can't connect: ",$dbh->errstr); $tth->execute; $koan = $tth->fetchrow_array;