title: php constructor not working
body: <p>I'm very new to php constructors I know of from java. But for some reason, this one is not running. I am following a tutorial and I can't seem to get a <code>1</code> only a <code>0</code>. Here are the two scripts involved:</p>
  
  <pre><code>&lt;?php
  
  class dbConnection{
      protected $db_conn;
      public $db_name = 'todo';
      public $db_user = 'root';
      public $db_pass = '';
      public $db_host = 'localhost';
  
      function connect(){
          try{
              $this-&gt;db_conn = new PDO("mysql:host=$this-&gt;db_host;db_name=$this-&gt;db_name",$this-&gt;db_user,$this-&gt;db_pass);
              return $this-&gt;db_conn;
          }
          catch(PDOException $e)
          {
              return $e-&gt;getMessage();
          }
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;?php
  
  include_once( 'class.database.php' );
  
  class ManageUsers {
      public $link;
      public $constructed;
  
      function ManageUsers(){
          $db_connection = new dbConnection();
          $this-&gt;link = $db_connection-&gt;connect();
          return $this-&gt;link;
      }
  
      function registerUser($username,$password,$ip_address,$time,$date){
          $query = $this-&gt;link-&gt;prepare("INSERT INTO users (username,password,ip_address,time,date) VALUES (?,?,?,?,?)");
          $values = array($username,$password,$ip_address,$time,$date);
          $query-&gt;execute($values);
          $counts = $query-&gt;rowCount();
          return $counts;
      }
  }
  
  
  $users = new ManageUsers();
  
  echo $users-&gt;registerUser('bob','bob','127.0.0.1','10:00','29-02-2012');
  ?&gt;
  </code></pre>