Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am extending mysqli in one of my classes. It works perfectly but the connection adds ~1 second to the php load time. I am wondering if there's a faster or more suitable way of connecting to MySql, or if there are database enhancements I can build for faster execution?
The 1 second overhead is purely the connection on my WAMP server, this is before I run any other queries.
Any ideas?
Thanks
class db extends mysqli {
//ACCESS VARIABLES FOR ENTIRE SITE
protected $_host = 'myhost';
protected $_user = 'myuser';
protected $_pass = 'mypass';
protected $_db = 'mydb';
function __construct() {
echo microtime(true)."<br />";
parent::__construct($this->_host, $this->_user, $this->_pass, $this->_db);
if ($this->connect_errno) die('Connect Error: ' . $this->connect_errno);
$this->set_charset("utf8");
echo microtime(true)."<br />";
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.