ti ringrazio mi è bastato utilizzarlo come un array... ma ora ho un'altro problema, mysql i_num_rows restituisce 0 anche quando c'è uno o più record nel database...

Codice PHP:
$graph $facebook -> api('/me','GET');                       
$firstname $graph['first_name'];           
$lastname $graph['last_name'];          
$mail $graph['email'];            
$uid $graph['id'];            
$birthday strtotime($graph['birthday']);            
$fb_profile $graph['link'];            
$username $graph['username'];            
$username_verified 0;            
$register_date time();           
            
 if(
$query $mysqli -> query("SELECT * FROM utenti WHERE uid='$uid'")) {                
if(
mysqli_num_rows($query) == 0) {                    
echo 
mysqli_num_rows($query);                   
 if(
$query2 $mysqli -> query("INSERT INTO utenti (uid, nome, cognome, email, data, fb_profile, username, username_verified, data_reg) VALUES ('$uid', '$firstname', '$lastname', '$mail', '$birthday', '$fb_profile', '$username', '$username_verified', '$register_date')")) {                       
 if(
$query3 $mysqli -> query("SELECT * FROM utenti WHERE uid='$uid'")) {                            
$row1 $query3 -> fetch_array(MYSQLI_ASSOC);                            
setcookie("id"$row1['id'], time()+31536000);                           
 
//header("location: /");                        
} else {                           
 echo 
$mysqli -> error;                        
}                    
} else {                        
echo 
$mysqli -> error;                   
 }               
 } else {                   
 
$row $query -> fetch_array(MYSQLI_ASSOC);                    
setcookie("id"$row['id'], time()+31536000);                    
header("location: /");                
}            
} else {                
echo 
$mysqli -> error;