title: Notice: Trying to get property of non-object in php code
body: <p>Why <code>$results</code> are NULL, where I did wrong ?</p>
  
  <p>I'm getting error in <code>$rows = $result-&gt;fetch_assoc();</code></p>
  
  <pre><code>class User{
  
      public $user_name;
      protected $_user_id;
      protected $_user_pwd;
      public $user_email;
      protected $_create_date;
  
      public  function selectUsers(){
  
          $db = Database::getInstance();
          $mysqli = $db-&gt;getConnection();
  
          $query = 'select * from tblusers';
          $result = $mysqli-&gt;query($query);
  
          if($result-&gt;num_rows)
          {
              $rows = $result-&gt;fetch_assoc();
              return $rows['$user_name'];
          }
      }
  
  }
  </code></pre>