function logout() 
{
$session_ida = $_SESSION['user']['name'];
$query3 = "UPDATE 'userlog' set 'logout' = CURTIME() where username = 
        '$session_ida'";
mysqli_query($db,$query3);
unset($_SESSION['user']['name']);
session_destroy();
header("location: login.php");
}
            Asked
            
        
        
            Active
            
        
            Viewed 22 times
        
    0
            
            
         
    
    
        Devon Bessemer
        
- 34,461
- 9
- 69
- 95
- 
                    1$db doesn't exist in this scope. Enable error reporting and always include those errors in your questions. – Devon Bessemer Aug 07 '18 at 17:09
- 
                    Pass $db as an element to the function call . – PHP Web Aug 07 '18 at 18:17
1 Answers
0
            
            
        You haven't defined the variable $db yet. I'll bet that you defined it in a different scope - however, as this is a separate function, this variable isn't directly accessible.
 
    
    
        Joel Rummel
        
- 802
- 5
- 18
