【问题标题】:how to fetch not null value data from mysql table如何从mysql表中获取非空值数据
【发布时间】:2018-04-27 11:46:52
【问题描述】:
<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
> 

【问题讨论】:

标签: mysql null


【解决方案1】:

您需要在查询中添加 where 子句。

代替:

SELECT * FROM ques

类似这样的:

SELECT * FROM ques
WHERE yourField is not null

yourField 更改为您要检查的任何字段。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-15
    • 2021-11-29
    相关资源
    最近更新 更多