|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-06-07 14:08 UTC] daarius at hotmail dot com
Description:
------------
class mydb extends mysqli {
public function __construct() {
parent::real_connect(); // can not use
parent::__construct(); // doesnt support 7th parameter of flags.
}
}
as above, the real_connect() gives some errors, and may be not allowed to be used, but in there the 7th parameter of flags are not present in connect() of mysqli. so what to do?
also, as real_connect() is not allowed, i can not use parent::options() for setting the config options before connect. as this gives errors too.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 18:00:01 2025 UTC |
Following code works, but not usefull if you want to use the "flags" for the connection which is not availabe in __construct() which i believe is a call to mysqli_connect() /** * Works ok, but without the option of flags */ class MyDb extends mysqli { public function __construct() { parent::__construct( 'localhost', 'root', NULL, 'test', 3306, NULL ); } } $o = new MyDb(); But, the real_connect() has the 7th option for "flags", but upon usage it gives the error: /** * This is needed, but does not work */ class MyDb extends mysqli { public function __construct() { parent::real_connect( 'localhost', 'root', NULL, 'test', 3306, NULL, 0 ); } } $o = new MyDb(); Error: Warning: mysqli::real_connect() [function.real-connect]: Couldn't fetch MyDb in C:\httpd\index.php on line 7