我想知道为什么我这样做有一些错误:
$query = "SELECT * FROM servers ";
while($rows = mysql_fetch_array(mysql_query($query)))
{
$database1 = array();
$database1['host'] = $rows['db_host'];
$database1['user'] = $rows['db_user'];
$database1['password'] = $rows['db_pass'];
$database1['table'] = $rows['db_user'];
$con1 = @mysql_connect($database1['host'], $database1['user'], $database1['password']) or die($connect_error);
if(!$con1) {
exit;
}
$connect_error = 'Sorry, there are some connection problems.';
mysql_select_db($database1['table']) or die($connect_error);
$info = mysql_fetch_assoc(mysql_query("SELECT COUNT(username) as total FROM authme"));
echo "No servidor ".$rows['name']." existem um total de ".$info['total']. " contas registradas, alem disso";
}
好的。以免解释:我有两个不同的数据库,在我编写此查询的第一个数据库中:
query = "SELECT * FROM servers ";
我在表服务器中有一个 mysql 连接。所以我必须连接不同的 mysqls 来获取 mysql 主机、用户和密码。当我得到这些东西时,我必须为每个连接获取一个值并使用 COUNT 作为回显这个值一个变量,当我这样做时:
$info = mysql_fetch_assoc(mysql_query("SELECT COUNT(username) as total FROM authme"));
echo "No servidor ".$rows['name']." existem um total de ".$info['total']. " contas registradas, alem disso";
我希望你们不理解,因为我的英语说得不太好):谢谢你们的关注..