示例#1
0
 /**
  * Connect to the database and set the error mode to Exception. 
  * @return void
  * @access public
  */
 public function connectToDB()
 {
     try {
         $dns = 'mysql:host=' . self::$hostname . ';dbname=' . self::$dbname;
         self::$instance = new PDO($dns, self::$username, self::$password);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $this->db = self::$instance;
     } catch (PDOException $e) {
         print "Error No <b> GEDM-1001 </b>";
         die;
     }
 }