我收到此错误 注意:未定义的索引:第17行的C:\ xampp \ htdocs \ RAU \ courses.php中的pharmacy.Name注意:未定义的索引:第19行的C:\ xampp \ htdocs \ RAU \ courses.php中的delivery.Phone注意:未定义的索引:第21行的C:\ xampp \ htdocs \ RAU \ courses.php中的delivery.Address
<link rel="stylesheet" href="style1.css">
<?php
$servername = "localhost";
$userrname = "root";
$password = "";
$dbname = "bless";
$conn = new mysqli($servername, $userrname, $password ,$dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sqlq="SELECT pharmacy.name,delivery.phone,delivery.address FROM delivery INNER JOIN pharmacy ON delivery.Pharmacy_id = pharmacy._id";
$rslt=$conn->query($sqlq) ;
$roww = $rslt->fetch_assoc();
echo "<br>";
echo "<br>";
echo "<td>" . $roww['pharmacy.name'] ;
echo "<br>";
echo"<td>". $roww['delivery.phone'];
echo "<br>";
echo"<td>". $roww['delivery.address'];
echo "<br>";
?>
答案 0 :(得分:0)
在MySQL查询中选择表时,列名称前面的名称是表:
'表名'。'列名'
它返回列名,但它告诉MySQL哪个表在不明确的情况下从中获取列数据。对于连接是一种安全的做法,但是当仅从一个表中进行选择时,它默认为该表。
使用
$roww['name']
$roww['phone']
$roww['address']