<form action="" method="POST"> <?php $que = $con->query("SELECT *
FROM ques"); while ($row=mysqli_fetch_array($que)){
echo "Q.".$row['id'].":".$row['que']."<br>"; echo "<input type='radio'
name='".$row['id']."'value='".$row['ans']."'>".$row['ans']."<br>";
echo "<input type='radio'
name='".$row['id']."'value='".$row['op1']."'>".$row['op1']."<br>";
echo "<input type='radio'
name='".$row['id']."'value='".$row['op2']."'>".$row['op2']."<br>";
echo <input type='radio'
name='".$row['id']."'value='".$row['op3']."'>".$row['op3']."<br>"; }
?> <br> <input type="submit" name="sub" value="submit"> </form
>
答案 0 :(得分:0)
您需要在查询中添加where子句。
而不是:
SELECT * FROM ques
这样的事情:
SELECT * FROM ques
WHERE yourField is not null
将yourField
更改为您正在检查的字段。