简体   繁体   English

WHERE {column} IS NOT NULL的PHP​​ SQL查询返回列中包含null的行

[英]PHP SQL query for WHERE {column} IS NOT NULL returns rows with null in column

I am running this query: 我正在运行此查询:

mysql_query("SELECT * FROM $pid WHERE ff IS NOT NULL ORDER BY time_out");

I am getting a response with some rows that are null in the ff column. 我得到一些响应,其中某些行在ff列中为空。

I verified this later on in the code with: 我稍后在代码中使用以下方法对此进行了验证:

if ($reps[$i]['ff'] == null)
    {
    $test = "ff is null";
    } 
else 
    {
    $test = $reps[$i]['ff'];
    } 

Not sure what I am missing here. 不知道我在这里想念的是什么。 Thanks in advance. 提前致谢。

使用查询

mysql_query("SELECT * FROM $pid WHERE ff IS NOT NULL and $pid != '' ORDER BY time_out");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM