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);

Recommended Answers

Create event in database MySQL event create

Jump to Post

All 3 Replies

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.