title: Running mysql query if column is false in PHP
body: <p>I am trying to display results of a mysql query and some html if the first mysql queries coulmn returns false or is set to false. I've tried a few things but I can't seem to get it to work properly, I will show code below. Any help is much appreciated. In the code I want to only display site message if the user's acknowledgement is false otherwise don't display anything.</p>
  
  <pre><code>function siteWideMessage()                                                                                                 
  {                                                                                                                          
      global $dbh;                                                                                                           
  
  
  
  $siteMessage = "";                                                                                                     
  
  $sUserInfo = $dbh-&gt;prepare("                                                                                           
      SELECT acknowledgement                                                                                             
      FROM user                                                                                                          
      WHERE uid = :uid                                                                                                   
  ");                                                                                                                    
  $sUserInfo-&gt;bindValue(":uid", $_SESSION["uid"]);                                                                       
  if ($sUserInfo-&gt;execute()) {                                                                                           
      $res = $sUserInfo-&gt;fetch();                                                                                        
      if ($res["acknowledgement"] = false) {                                                                             
          $stmt = $dbh-&gt;query("                                                                                          
              SELECT message                                                                                             
              FROM SiteWideMessages                                                                                      
              ORDER BY idSiteWideMessages DESC                                                                           
              LIMIT 1                                                                                                    
          ");                                                                                                            
          while ($row = $stmt-&gt;fetch()) {                                                                                
              $siteMessage .= "                                                                                          
                  &lt;div class='siteMessage'&gt;                                                                              
                      &lt;span&gt;" . $row["message"] . "&lt;/span&gt;                                                               
                      &lt;br&gt;&lt;br&gt;                                                                                           
                      &lt;span style='font-weight:normal;'&gt;I acknowledge that I have read this important site message&lt;/span&gt;
                      &lt;br&gt;                                                                                               
                      &lt;input type='submit' name='submit' value='I Agree'&gt;&lt;/input&gt;                                        
              &lt;/div&gt;";                                                                                                   
          }                                                                                                              
      }                                                                                                                  
      $sUserInfo-&gt;closeCursor();                                                                                         
  }                                                                                                                      
  
  if (isset($_POST["submit"])) {                                                                                         
  
      $stmt = $dbh-&gt;prepare("                                                                                            
          UPDATE user                                                                                                    
          SET `acknowledgement` = 'true'                                                                                 
          WHERE uid = :uid                                                                                               
      ");                                                                                                                
      $stmt-&gt;bindValue(":uid", $_SESSION["uid"]);                                                                        
      if($stmt-&gt;execute()) {                                                                                             
          $stmt-&gt;closeCursor();                                                                                          
      }                                                                                                                  
  }                                                                                                                      
  return $siteMessage;                                                                                                 } 
  </code></pre>
  
  <p>UPDATE:
  I managed to get it working the way I want it to I just had to do as the following.</p>
  
  <pre><code>if ($res["acknowledgement"] == 'false')
  </code></pre>
  
  <p>Thanks for everyone's help! </p>