title: object not initiating as intended PHP OOP
body: <p>I am new to php and OOP in general, so have decided to turn my existing site in an oo php one to gain some experience.
  Here is the issue I am currently facing.</p>
  
  <p>I have a class Normaluser which is extending from User. Inside the User class is a login method which returns an object containing an array of the Users class' properties.</p>
  
  <pre><code>class NormalUser extends User {
  
  public function __construct($loginarray){
      $email = $loginarray['email'];
      $pass = $loginarray['pass'];
  
      var_dump ( parent::login($email,$pass) );
      //return parent::login($email,$pass)
  }
  }
  </code></pre>
  
  <p>When doing a var_dump (as above) I get</p>
  
  <pre>bool(false) object(User)#8 (4) 
  { ["user_id"]=> string(1) "1" ["first_name"]=> string(7) "Melanie" ["last_name"]=> string(6) "Janson" ["user_level"]=> string(1) "1" }
  </pre>
  
  <p>Yet after calling the code in my login.php page : </p>
  
  <pre><code>$postdata = User::mysqli_array_escape($_POST);      
  
      $email = $postdata['email'];
      $pass = $postdata['pass'];
  
      $userstart = new NormalUser($postdata);
      var_dump($userstart);
  </code></pre>
  
  <p>I would think that calling <code>$userstart</code> as a new NormalUser object would return the correct variables, yet when I do a var_dump (as written in above) I receive the following :</p>
  
  <pre>
  object(NormalUser)#5 (4) 
  { ["user_id"]=> NULL ["first_name"]=> NULL ["last_name"]=> NULL ["user_level"]=> NULL } 
  </pre>
  
  <p>I do not understand where I have gone wrong, If anyone would be able to point me in the right direction I would be greatly appreciative.</p>
  
  <p>Thank you.</p>
  
  <p>EDITED : added user.php login method as requested</p>
  
  <pre><code>    public static function login($email, $pass) {
      global $database;
      $sql = "SELECT user_id, first_name, last_name, user_level FROM users WHERE (email='$email' AND pass=SHA1('$pass')) AND active IS NULL LIMIT 1";
      $results = self::find_by_sql($sql);
      //var_dump($results);
      if (!empty($results)) {
  
          return array_shift($results);
      } else {
          return false;
      }
  
  }
  </code></pre>