Php 语法问题阻止在HTML表中显示mySQL结果

Php 语法问题阻止在HTML表中显示mySQL结果,php,mysql,Php,Mysql,我有下面的脚本,它应该显示MySQL查询的结果,并填充下表,但它确实会显示空表。我知道应该显示结果,但我不确定语法问题在哪里: <table> <tr> <th>Country</th> <th>Part</th> <th>Description</th> <th>Quantity</th> <th>Ship_Date<

我有下面的脚本,它应该显示MySQL查询的结果,并填充下表,但它确实会显示空表。我知道应该显示结果,但我不确定语法问题在哪里:

<table>
<tr>
    <th>Country</th>
    <th>Part</th>
    <th>Description</th>
    <th>Quantity</th>
    <th>Ship_Date</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "username", "password", "dbname");
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "
  SELECT t1.Country
     , t2.Part
     , t2.Description
     , Sum(t2.Quantity) AS Quantity
     , t1.ship_time
  FROM Table1 t1
  JOIN Table_Data2 t2 
    ON t1.CodeValue = t2.CodeValue
 WHERE t2.Part IN ('BB1234', 'BB-3454')
   AND t1.ship_time = Current_Date()
 GROUP 
    BY t1.Country
     , t2.Part
     , t2.Description
     , t1.ship_time;
";

$result = $conn->query($sql);
if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "<tr><td>".$row["t1.Country"].
         "</td><td>".$row["t2.Part"]. 
         "</td><td>". $row["t2.description"]. 
         "</td><td>" .$row["t2.quantity"].
         "</td><td>". $row["t1.ship_time"]. "</td><td>";
    }
    echo "</table>";
} else { 
    echo "0 results"; 
}
$conn->close();
?>
</table>

国家
部分
描述
量
装船日期
echo.“$row[“t1.Country”]
您应该像下面这样替换:

echo "<tr><td>".$row["Country"]
echo.“$row[“Country”]

并将t1和t2从所有其他文件中删除

是否报告错误?没有出现错误消息,但我怀疑错误可能是在我执行
回显“.”时出现的。$行[“t1.Country”]。
每个标题都是数据库的名称“dbname”?您的用户名是“username”,密码是“password”?我已经删除了这个示例的实际值,而不是t1。请尝试使用“Country”并记住表关联区分大小写,所以Country!=国家/地区,您只需打印r($row),然后查看值是否与您提到的键一起出现。。。如果我没有弄错的话,它应该是$row=mysqli\u fetch\u assoc($result)。您还可以提到,在其他一些参考资料中,例如
Description
!==<代码>说明
echo "<tr><td>".$row["Country"]