How to check if MySQL returns null/empty?

前端 未结 6 1428
一个人的身影
一个人的身影 2020-12-08 07:38

In DB I have a table with a field called fk_ownerID. By default, when I add a new table row, the fk_ownerID is empty. In Toad for MySQL, this is sh

6条回答
  •  攒了一身酷
    2020-12-08 08:13

    if ( (strlen($ownerID) == 0) || ($ownerID == '0') || (empty($ownerID )) )
    

    if $ownerID is NULL it will be triggered by the empty() test

    https://www.php.net/empty

提交回复
热议问题