troubleshooting Question

Cannot understand error

Avatar of Richard Korts
Richard KortsFlag for United States of America asked on
PHP
5 Comments1 Solution34 ViewsLast Modified:
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?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros