Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function __construct($strHost='', $strDB='', $strUser='', $strPass='')
- {
- try{
- if($strHost != ''){$this->strHost = $strHost;}
- if($strDB != ''){$this->strDB = $strDB;}
- if($strUser != ''){$this->strUser = $strUser;}
- if($strPass != ''){$this->strPass = $strPass;}
- $this->objDB = new PDO("mysql:host=".$this->strHost.";port=3306;dbname=".$this->strDB,$this->strUser, $this->strPass, array( PDO::ATTR_PERSISTENT => true));
- if($this->objDB)
- {
- return $this->objDB;
- }
- else
- {
- echo "Database Connection Failed.";die;
- }
- }
- catch(Exception $objException)
- {
- echo $objException->getMessage();exit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement