简体   繁体   中英

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.

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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