示例#1
0
 public static function connect()
 {
     Makiavelo::info("Connecting to database...");
     DBLayer::loadConfiguration();
     $__db_conn = null;
     if (DBLayer::$config['name'] != "") {
         $__db_conn = mysql_connect(DBLayer::$config['host'], DBLayer::$config['user'], DBLayer::$config['pwd']);
         if (!$__db_conn) {
             Makiavelo::error("Can't connect to database, using configuration: ");
             Makiavelo::error(print_r(DBLayer::$config, true));
             Makiavelo::error("MYSQL ERROR::" . mysql_error());
         }
     }
     DBLayer::selectDB();
     return $__db_conn;
 }