How to update mysql db on session destroy
<p>Hello I have question about updating mysql db field with enum 1 and 0 and when the user log in it change it to 1 but when user log out i tried doing this but it won't work...
Also  I tried make it as button and if btn is pressed do something and then go to logout.php but it didnt work ... </p>

<p>So my code is this ...</p>

<pre><code>&lt;?php include_once('connect.php');
$logger = $_SESSION["login"];
session_start();
session_unset();
session_destroy();


    $mysqli = "UPDATE table SET field='0' WHERE email='$logger'";
    if(mysqli_query($con, $mysqli)){

header("Location: index.php");}else echo "Something went wrong!";
?&gt;
</code></pre>