我有一个包含 4 列的数据库:
- 地点
- 日期
- 队名
- 分数
我需要结果页面来选择并组合“Team_Name”(当相等时)和“Score”总和,并且仅在单个位置“BW3Avon”显示当前月份。
这是我的代码
<?php
$con = mysql_connect("localhost","*******_admin","g********1");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("x0kqgoub_bw3avonscore", $con);
$sql = "SELECT * FROM bw3avonscore WHERE MONTH(myDate) = MONTH(CURRENT_DATE)";
$result = mysql_query("SELECT * FROM bw3avonscore Team_Name ORDER BY Score DESC");
while($row = mysql_fetch_array($result))
{
echo $row['Team_Name'] . " " . $row['Score'];
echo "<br />";
}
mysql_close($con);
?>