这是我的代码:
<?php
$con = mysqli_connect("127.0.0.1:3306","root","root","photoshare");
$query = "SELECT ID,nickname,photoLikes FROM tbl_photo";
$result = mysqli_query($con,$query);
$query_dislike = "SELECT nickname, idGivenLike FROM tbl_check_like";
$resultDislike = mysqli_query($con,$query_dislike);
$photoIDdislike;
$photoID;
while($photoID = mysqli_fetch_assoc ($result) || $photoIDdislike = mysqli_fetch_assoc($resultDislike) )
{
//checks if both of results
if($result["ID"] != $resultDislike["idGivenLike"])
{
echo "true";
}
}
?>
当我运行它时,它说下一行
if($result["ID"] != $resultDislike["idGivenLike"])
带有 h 致命错误: Fatal error: Cannot use object of type mysqli_result as array
为什么它不起作用,我该如何解决?