2 つのテーブルの合計を合計して、それを自分の Web サイトに配置したいのですが、試したコードは次のとおりです。
<?php
$host = "localhost";
$username = "runerebe_online";
$password = "***";
$db_name = "runerebe_online";
mysql_connect("$host", "$username", "$password") or die (mysql_error ());
mysql_select_db("$db_name") or die(mysql_error());
$host = "localhost";
$username = "runerebe_online2";
$password = "***";
$db_name = "runerebe_online2";
mysql_connect("$host", "$username", "$password") or die (mysql_error ());
mysql_select_db("$db_name") or die(mysql_error());
$total = "SELECT (online + online2)";
$rs = mysql_query($total);
while($row = mysql_fetch_array($rs)) {
echo $row['total'];
}
mysql_close();
?>
これは私がこれを使用したときのエラー印刷です
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/runerebe/public_html/home/index.php on line 63
これは 63 行目で、内容は次のとおりです。
63: while($row = mysql_fetch_array($rs)) {
64: echo $row['total'];
65: }