PHP检查行和会话是否为空

im trying to check if the row in table is empty and the session also in , can i know what im doing wrong here.

 if (empty($row['images']) && (!isset($_SESSION['picture']) || $_SESSION['picture'] == ''))

EDIT : posting the code as im trying to post some divisions based on the picture, and if there are no picture i post a demo. i hope i explained it right.

if (mysqli_multi_query($conn, $sql)) {
    do {
        if ($result = mysqli_store_result($conn)) {
            while ($row = mysqli_fetch_array($result)){
                if (empty($row['images']) && (!isset($_SESSION['picture']) || $_SESSION['picture'] == '')){
                    echo "<div>" ;
                    echo "                  <img src='images/logo.png' alt=""/>";
                    echo "                  <h1>This Is A Demo</h1>";
                    echo "                  <p>This is a Demo paragraph .</p>";
                    echo"                   <a href='../go_back.php'>Demo</a>";
                    echo "</div>" ;
                } else{
                    echo "<div>" ;
                    if(!empty($row['images'])) {
                        echo "                  <img src='images/users_iamge.png' alt=""/>";
                        echo "                  <h1>Not Demo</h1>";
                        echo "                  <p>This is Not Demo paragraph .</p>";
                    }else{ // fetch the session
                        echo "                  <img src='images/users_iamge.png' alt=""/>";
                        echo "                  <h1>Not Demo</h1>";
                        echo "                  <p>This is Not Demo paragraph .</p>";
                    }
                }       
                echo'<h1>' 
                echo'<p>'
                echo "</div>";                  
            }
            mysqli_free_result($result);
        }   
    } while (mysqli_more_result($conn));
}

Your logic appears to be wrong. Recapping basic operators in php.

The second condition in an or is only evaluated if the first condition evaluates to false.

Hence if $_SESSION['picture'] is set, the evaluation of $_SESSION['picture'] == '' will never occur (as the first condition of the or evaluates to true).

To get the functionality you desire (truetable below)

Empty  | SEmpty  | SNull  | Result
-------+---------+--------+---------
  0        0         0        0
  0        0         1        0
  0        1         0        0
  0        1         0        0
  1        0         0        0
  1        0         1        1
  1        1         0        1
  1        1         1        1

You need:

if( empty($row['images']) && 
       ( (isset($_SESSION['picture']) && $_SESSION['picture'] == '') ||
         !isset($_SESSION['picture']) ) 
  )