I'm trying to create an object derived from the MySQLi object to easier handle database connections for my application. The thing is that I do not know how I shall be able to initalize the connection and keep it contained in the object. Let me illustrate what I mean:
<?php
class db extend mysqli {
//Overriding connect()
public function connect($info){
//This is where I get lost
//I Want to be able to connect
//without creating a new object
//with mysqli_init()
$mysqli = mysqli_init();
$mysqli->real_connect(...);
//I want the connection to be
//"attached" to $this object so that
//the code would look something like...
$this->init();
$this->real_connect(...);
//But this I cannot do because of the
//object that mysqli_init() returns which is
//needed for mysqli_real_connect()
}
}
?>
Any Ideas?