function db_open() { global $dbhost,$dbuser,$dbpass,$db,$db_type; $result = @mysqli_connect ($dbhost, $dbuser, $dbpass); if (is_resource($result)) mysqli_select_db($result,$db) or die ("Could not select DB - CON2".mysqli_error($result)); e DB if (!is_resource($result)) die ("DB($db_type): {$result} Could not connect to the Database.\n"); return $db_conn; }
注意: This function should only be used to change the default database for the connection. You can select the default database with 4th parameter in mysqli_connect().