Your IP : 216.73.216.91


Current Path : /var/www/html/llcfapp/api/base/
Upload File :
Current File : /var/www/html/llcfapp/api/base/DbConnect.php

<?php
class DbConnect extends Config{
	private $credentials = array();
    private $serverAddress;
    private $username;
    private $password;
    private $dbname;
    private $conn;
    public function connect(){
		$this->credentials = $this->getDbCredentials();
        $this->serverAddress = $this->credentials['serverAddress'];
        $this->username = $this->credentials['username'];
        $this->password = $this->credentials['password'];
        $this->dbname = $this->credentials['dbname'];
        try {
            $this->conn = new PDO("mysql:host=$this->serverAddress;dbname=$this->dbname", $this->username, $this->password, Array(PDO::MYSQL_ATTR_INIT_COMMAND =>'SET SESSION group_concat_max_len=3423543543'));
            // set the PDO error mode to exception
            $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        }catch(PDOException $e){
            echo "Connection failed: " . $e->getMessage();
        }
        return $this->conn;
    }
}
?>