Example #1
0
 function connect()
 {
     if (!$this->_conn instanceof PDO) {
         $this->_conn = new PDO('mysql:dbname=' . $this->_db_db . ';host=' . $this->_db_host, $this->_db_user, $this->_db_user);
         $this->_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         # Create the database structure
         $dbStruct = new SpotStruct_mysql($this);
         $dbStruct->createDatabase();
     }
     # if
 }
Example #2
0
 function connect()
 {
     $this->_conn = @mysql_connect($this->_db_host, $this->_db_user, $this->_db_pass);
     if (!$this->_conn) {
         throw new Exception("Unable to connect to MySQL server: " . mysql_error());
     }
     # if
     if (!@mysql_select_db($this->_db_db, $this->_conn)) {
         throw new Exception("Unable to select MySQL db: " . mysql_error($this->_conn));
         return false;
     }
     # if
     # Create the database structure
     $dbStruct = new SpotStruct_mysql($this);
     $dbStruct->createDatabase();
 }