title: Query returning empty set in script, works in PHPMyAdmin and on local version
body: <p>This has been plaguing me for hours now. This code works perfectly on my local machine, and the query executes in phpmyadmin, etc. </p>
  
  <p>I have the following code:</p>
  
  <pre><code> &lt;?php
  
      class db {
          public $server = 'localhost';
          public $user = '***';
          public $passwd = '***';
          public $db = '***';
          public $dbCon;
  
          function __construct(){
              $this-&gt;dbCon = mysqli_connect($this-&gt;server, $this-&gt;user, $this-&gt;passwd, $this-&gt;db);
          }
  
          function __destruct(){
              mysqli_close($this-&gt;dbCon);
          }
  
          private function getFileTree($catID) {
  
              $sql = "SELECT
                          *
                      FROM
                          table_name
                      WHERE
                              cat_id = ".$catID;
  
              $results = mysqli_query($this-&gt;dbCon, $sql);
  
  
              return $results;
          }
  
  
  
      }
  
  $db = new db();
  
  $cat_id = 1;
  
  $data = $db-&gt;getFileTree($cat_id);
  
  echo json_encode($data);
  
  
  ?&gt;
  </code></pre>
  
  <p>I'm stumped because the query looks fine, it runs in PHPMyadmin, and the script works fine on my local version but once I moved to server it just returns an empty array. Only thing I can think is its something to do with older php version on the server, but still seems like it should work, all my other queries are working fine.</p>
  
  <p>Also when I var_dump $results, I get the following when trying one cat_id in the db:</p>
  
  <pre><code>NULL NULL NULL NULL NULL array(1) { [""]=&gt; NULL }
  </code></pre>
  
  <p>and the following when I try the other cat_id:</p>
  
  <pre><code>object(mysqli_result)#3 (5) { ["current_field"]=&gt; int(0) ["field_count"]=&gt; int(6) ["lengths"]=&gt; NULL ["num_rows"]=&gt; int(24) ["type"]=&gt; int(0) } [null]
  </code></pre>