Example #1
0
 private function getDbConnect($address, $account, $pwd, $name)
 {
     if (DB_TYPE == 'mssql') {
         return mssql_connect($address, $account, $pwd);
     }
     if (DB_TYPE == 'sqlsrv') {
         if (defined('DBITPro_Dev')) {
             $connectionInfo = array("UID" => $account, "PWD" => $pwd, "Database" => $name);
         } else {
             $connectionInfo = array("UID" => $account, "PWD" => $pwd, "Database" => $name);
         }
         $conn = sqlsrv_connect($address, $connectionInfo);
         if (false === $conn) {
             echo "Could not connect.\n";
             die(print_r(sqlsrv_errors(), true));
         }
         return $conn;
     }
     if (DB_TYPE == 'mysql') {
         $conn = mysql_connect($address, $account, $pwd);
         if (false === $conn) {
             echo "Could not connect.\n";
             die(print_r(mysql_errors(), true));
         }
         return $conn;
     }
 }
Example #2
0
 public function __construct()
 {
     $this->conn = mysql_connect($this->serverName, $this->userName, $this->pass);
     if ($this->conn) {
         if (mysql_select_db($this->database, $this->conn)) {
             $this->flag_conn = 0;
         } else {
             $this->flag_conn = 1;
             die(print_r(mysql_errors(), true));
         }
     } else {
         $this->flag_conn = 1;
         die(print_r(mysql_error(), true));
     }
 }
Example #3
0
function db_test()
{
    if ($conn === false) {
        die(print_r(mysql_errors(), true));
    }
}
Example #4
0
 public function query($query)
 {
     $query = mysql_query($query) or die(mysql_errors(mysql_error()));
     return $query;
 }