$send = $database->query('SELECT * FROM `usernames` ORDER BY RAND() LIMIT 1');
while ($show = mysql_fetch_array($send)) {
echo ''.$show['usernames'];
}
$ts = $database->query('SELECT * FROM `usernames` ORDER BY RAND() LIMIT 1');
while ($show = $ts->fetch(PDO::FETCH_ASSOC)) {
echo ''.$show['usernames'];
}
为了完整性,您只希望得到一行结果,因此while循环可能是多余的:
$ts = $database->query('SELECT * FROM `usernames` ORDER BY RAND() LIMIT 1');
$show = $ts->fetch(PDO::FETCH_ASSOC);
echo $show['usernames'];
3条答案
按热度按时间qcuzuvrc1#
6tr1vspr2#
试试这个
ujv3wf0j3#
这将修复php错误:
为了完整性,您只希望得到一行结果,因此while循环可能是多余的: