2013-05-13 15 views
5

sto per aprire il mio sito web quando ho notato che uno dei miei mods mi da questo errore:Fatal error: Impossibile utilizzare oggetto di tipo mysqli_result

Fatal error: Cannot use object of type mysqli_result as array in /var/www/vbsubscribetouser.php on line 303

ho andato alla linea 303 e questo è cosa ho trovato:

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

Ecco tutte le codice che inizia alla riga 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] 
"); 

io non sono un esperto di codifica php, quindi un bi t di aiuto sarebbe bello prima di aprire il sito. Qualsiasi aiuto/suggerimento?

Grazie mille!

risposta

20

Cannot use object of type mysqli_result as array

Uso mysqli_fetch_assoc o mysqli_fetch_array Per recuperare una riga in un array associativo.

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

o

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

che ha fatto. Grazie mille! Dovrei iniziare ad imparare qualche php! –

Problemi correlati