Avatar of Richard Korts
Richard Korts
Flag for United States of America

asked on 

Cannot understand error

Terribly embarrassed about this, it has to be obvious, but I cannot see it:

Here is code snippet:

   $spok = false;
   if (isset($_SESSION['uid'])) {
      $qrys = "SELECT * from steps where uid = " . $_SESSION['uid'];
      $ress = mysqli_query($link, $qrys);
      $ns = mysqli_num_rows($ress);
      if ($ns != 0) {
         $stps = mysqli_fetch_array($ress,MYSQLI_ASSOC);
         if ($stps['initial'] == "Y") {
            $spok = true;
         }
      }
   }
   if (! isset($spok)) {
      $spok = false;
   }   
echo "spok = " . $spok . "<br>";  

The echo shows spok =

No value. How can it not be either 0 or 1?
PHP

Avatar of undefined
Last Comment
Scott Fell

8/22/2022 - Mon