Not really. More like this:
class myMySQLiAccess extends mysqli {
public function __construct($host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null) {
parent::__construct($host, $username, $passwd, $dbname, $port, $socket);
}
}
if you want to hardcode your access credentials (not really a good idea) it would look like this
class myMySQLiAccess extends mysqli {
public function __construct($host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null) {
parent::__construct('localhost', 'root', 'password', 'mydatabase');
}
}
$con = new myMySQLiAccess();
closing is done like this
$con->close();
but in most cases you can safely let PHP close the connection for you (it does it automatically when script ends, or when the scope of $con is destroyed)