详情页

致命错误:无法使用类型mysqli_result的对象

时间:2023年12月14日

编辑:佚名

我要打开我的网站时,我发现我的MODS的人给我这个错误:致命错误:无法使用类型mysqli_result的对象
Fatal error: Cannot use object of type mysqli_result as array in /var/www/vbsubscribetouser.php on line 303
我就去查看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代码方面的专家,所以双在打开网站之前,帮助会很好。任何帮助/建议?
非常感谢!
Cannot use object of type mysqli_result as array
使用mysqli_fetch_assoc或mysqli_fetch_array抓取结果一行作为关联阵列。
$query = "SELECT 1"; 
$result = $mysqli->query($query); 
$followingdata = $result->fetch_assoc() 

$followingdata = $result->fetch_array(MYSQLI_ASSOC); 
这解决了我的问题,非常感谢你!我应该开始学习一些PHP技术!
相关文章
猜你需要