title: Error in my User.php file when learning Simple PDO login system
body: <p>Please,am learning how to code a simple PDO login system. One of my files, that is User.php has an error after rendering.</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;?php
  
  include_once('connection.php');
  class User{
  
  private $db;
  public function _construct(){
  
  $this-&gt;db = new Connection();
  $this-&gt;db = $this-&gt;db-&gt;dbConnect();
  }
  public function login($name,$pass){
  
  if(!empty($name) &amp;&amp; !empty($pass)){
  
      $stmt = $this-&gt;db-&gt;prepare(" SELECT * FROM users WHERE name = ? and pass = ? ");
      $stmt -&gt; bindParam(1,$name);
      $stmt -&gt; bindParam(2,$pass);
      $stmt -&gt; execute();
  
      if($stmt-&gt;rowCount()==1){
          echo "successfully login";
      }else{
          echo "incorrect username or password";
      }
      } else{
          echo "enter correct username and password";
      }
  </code></pre>
  
  <p>Here is the error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function prepare() on null in
    C:\xampp\htdocs\simplelogin\User.php on line 16</p>
  </blockquote>