当任何用户登录时,我只想从数据库表中获取 3 个数据。之后,当下一个用户登录时,下一个 3 个问题就会出现。我怎样才能做到这一点?我应该在 SELECT 查询中进行哪些更改?
$sql ="SELECT * FROM questiontypes";
$query = mysql_query($sql);
$qset = "";
while($result = mysql_fetch_array($query)) {
$qset .='<li id="qtypeli">'.$result['qtname'].'</li>';
$sql1 = "select questions .* from questions where qtype='".$result['qtname']."'order by RAND() LIMIT 3";
$query1 = mysql_query($sql1);
while($result1 = mysql_fetch_array($query1)) {
$qset .='<li id="'.$result1['qid'].'" qt="'.$result1['qtid'].'"><span class="qnamespan"> '.$i.'. '.$result1['qname'].'</span></li>