Hi All

Can anyone help me, if user inactivity and update my datbase row automaticlly ( I mean time set if user inactivity or browser close )

Before login
  $sql = "UPDATE register set logged_in='1' WHERE (matri_id='" . $username . "' OR email='" . $username . "')";
        $DatabaseCo->dbLink->query($sql);


After login
  $sql = "UPDATE register set logged_in='0',last_login = '" . $_SESSION['login_time'] . "' WHERE matri_id='" . $_SESSION['user_id'] . "'";

$DatabaseCo->dbLink->query($sql);

Above code is working but user closed the browser and never loged out user is showing always online .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.