本文介绍了致命错误:无法使用类型mysqli_result对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要打开我的网站时,我发现我的MODS的人给我这个错误:

I've went to line 303 and this is what I found:

//Check if requested username can be followed.
if (in_array($followingdata['usergroupid'], explode("|", $vbulletin->options['subscribetouser_usergroups_cannot']))){

Here is all the code starting at line 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]
");

I'm not an expert in php coding, so a bit of help would be great before opening the website. Any help/suggestions?

Thank you very much!

解决方案

Use mysqli_fetch_assoc or mysqli_fetch_array to fetch a result row as an associative array.

$query = "SELECT 1";
$result = $mysqli->query($query);
$followingdata = $result->fetch_assoc()

or

$followingdata = $result->fetch_array(MYSQLI_ASSOC);

这篇关于致命错误:无法使用类型mysqli_result对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:31