当我注意到我的一个模组给我这个错误时,我将要打开我的网站:
致命错误:无法在第303行的/var/www/vbsubscribetouser.php中将mysqli_result类型的对象用作数组
我去了303行,这就是我发现的内容:
//Check if requested username can be followed. if (in_array($followingdata['usergroupid'], explode("|", $vbulletin->options['subscribetouser_usergroups_cannot']))){
这是从第303行开始的所有代码:
//Check if requested username can be followed. if (in_array($followingdata['usergroupid'], explode("|", $vbulletin->options['subscribetouser_usergroups_cannot']))){ exit; } if ($followinginfo[subscribers] > 0){ $user_followers = $followinginfo[followers].$userinfo[userid].'|'; } else{ $user_followers = '|'.$userinfo[userid].'|'; } $vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "user SET subscribers = subscribers + 1, `followers` = '$user_followers' WHERE userid = $followinginfo[userid] ");
我不是php编码方面的专家,因此在打开网站之前会有所帮助。任何帮助/建议吗?
非常感谢你!
无法将类型为mysqli_result的对象用作数组
使用mysqli_fetch_assoc或mysqli_fetch_array提取结果行作为关联数组。
mysqli_fetch_assoc
mysqli_fetch_array
$query = "SELECT 1"; $result = $mysqli->query($query); $followingdata = $result->fetch_assoc()
要么
$followingdata = $result->fetch_array(MYSQLI_ASSOC);