我对PHP和MySQL相当新,并且我已经在不同的地方阅读了我已经设法将这个脚本拼凑在一起的东西,不幸的是输出不是我预期的,我得到了很多: / p>
Buffer Status 2H: Notice: Undefined variable: row in /var/www/secretbit/allbuff.php on line 53 0 records. <br />
Buffer Status TC: Notice: Undefined variable: row in /var/www/secretbit/allbuff.php on line 54 0 records. <br />
Buffer Status ST: Notice: Undefined variable: row in /var/www/secretbit/allbuff.php on line 55 0 records. <br />
Buffer Status 3C: Notice: Undefined variable: row in /var/www/secretbit/allbuff.php on line 56 0 records <br />
以下是我用来编译这个怪物的代码:
<?php
error_reporting(-1);
ini_set('display_errors', true);
$con = mysqli_connect(
'192.168.20.10',
'root2',
'password',
'contaque'
);
$con2 = mysqli_connect(
'192.168.20.222',
'root2',
'password',
'contaque'
);
$con3 = mysqli_connect(
'192.168.20.8',
'root2',
'password',
'contaque'
);
$res = mysqli_query(
$con,
"SELECT COUNT(*) AS 'total1' FROM contaque_hopper WHERE campaign_id = 'CLOSERUK';"
);
$res = mysqli_query(
$con2,
"SELECT COUNT(*) AS 'total2' FROM contaque_hopper WHERE campaign_id = 'CLOSERTC';"
);
$res = mysqli_query(
$con2,
"SELECT COUNT(*) AS 'total3' FROM contaque_hopper WHERE campaign_id = 'CLOSERST';"
);
$res = mysqli_query(
$con3,
"SELECT COUNT(*) AS 'total4' FROM contaque_hopper WHERE campaign_id = 'CLOSER3C';"
);
echo 'Buffer Status 2H: ', (int)$row['total1'], ' records. <br />';
echo 'Buffer Status TC: ', (int)$row['total2'], ' records. <br />';
echo 'Buffer Status ST: ', (int)$row['total3'], ' records. <br />';
echo 'Buffer Status 3C: ', (int)$row['total4'], ' records. <br />';
?>