我正在尝试检索已存储到php-mysql中的数据。当我试图执行下面的代码时,出现了一个错误:
注意:试图在第27 0行的/storage/ssd5/459/2549459/public\u html/x.php中获取非对象的属性
x、 PHP
<?php
$conn = mysqli_connect("localhost" , "id2549459_salamnti" , "0000000000" , "id2549459_tutorial");
if($conn -> connect_error){
die("my connection faild" . $conn -> connect_error);
}
$sql = "SELECT id, military_num , firstname, lastname,image from students";
$result = $conn-> query($sql);
if($result -> num_rows > 0){
while($row = $result-> fetch_assoc()){
echo "<tr> <td>" . $row["id"] . "</td> <td>" . $row["militry_num"] . "</td> <td>". $row["firstname"]. "</td><td>" . $row["lastname"] . "</td><td>" . $row["image"] . "</td> </tr>";
}
echo "</table>";
}
else{
echo "0 result";
}
$conn -> close();
?>
1条答案
按热度按时间osh3o9ms1#
有很多理由…11。mysql上的用户没有从students 2访问的权限。数据库中不存在列