我正在为应用程序使用两个数据库连接。建立的数据库连接如下
$allrights = @mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$allrights) {
//die("Database connection failed: " . mysql_error());
echo "Check ServerHost,Username,Password Of the DataBase<br/>";
}
// 2. Select a database to use
$db_select = @mysql_select_db(DB_NAME,$allrights);
if (!$db_select) {
//die("Database selection failed: " . mysql_error());
echo "Incorrect DataBase Name";
}
// 1. Create a database connection
$readonly = @mysql_connect(DB_SERVER,READONLY_DB_USER,READONLY_DB_PASS);
if (!$readonly) {
//die("Database connection failed: " . mysql_error());
echo "Check ServerHost,Readonly-Username,Password Of the DataBase<br/>";
}
// 2. Select a database to use
$db_select = @mysql_select_db(DB_NAME,$readonly);
if (!$db_select) {
//die("Database selection failed: " . mysql_error());
echo "Incorrect DataBase Name";
}
但是,在查询所有内容时,例如
$query=mysql_query("SELECT * FROM <tablename>");
两个连接都引用同一个数据库。查询数据时实际调用了哪些连接?