Hi all,
Ok. Here is a code that I'm studying:
class Connection extends PDO {
private $dsn = 'mysql:dbname=testes;host=127.0.0.1';
private $user = 'root';
private $password = '';
public $handle = null;
function __construct( ) {
try {
if ( $this->handle == null ) {
$dbh = parent::__construct( $this->dsn , $this->user ,
$this->password );
$this->handle = $dbh;
return $this->handle;
}
}
Can I replace this part:
$dbh = parent::__construct( $this->dsn , $this->user , $this->password );
$this->handle = $dbh;
return $this->handle;
By this: (?)
$this->handle = parent::__construct( $this->dsn , $this->user ,
$this->password );
And put a return on my getHandler method?
If so, is there any special reason that we should know about using a
structure like this?
$dbh = parent::__construct( $this->dsn , $this->user , $this->password );
$this->handle = $dbh;
return $this->handle;
Thanks a lot,
Márcio
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php