- if(class_exists('mysqli')) {
- $this->db = new mysqli($server,$user,$pass,$db);
- if(NULL === $this->db->connect_error) {
- $this->connected = true;
- } else {
- throw new RuntimeException($this->db->connect_error);
- }
- } else {
- $this->mysqli = false;
- $this->db = mysql_connect($server,$user,$pass);
- if($this->db && mysql_select_db($db,$this->db)) {
- $this->connected = true;
- } else {
- throw new RuntimeException(mysql_error());
- }
+ if(class_exists('mysqli')) {
+ $this->db = @new mysqli($server,$user,$pass,$db);
+ if(! mysqli_connect_errno()) {
+ $this->connected = true;