I only want these update query to work if the event happened. The problem I'm facing is whichever the last query is is overriding the first one and even worse, this update query doesn't even update with the if statement. I've tried to change a lot of things.
What am I doing wrong?
<?php
$logout_button="header(location:'logout.php')";
if ($logout_button){
$logged_out="offline";
$useronline_sql = mysql_query("UPDATE users SET status = '$logged_out' WHERE username='$username'");
}?>
<script type="text/javascript">
(function(){
var moved = false
window.onmousemove = function(e){
if(!moved){
moved = true;
<?php
$stat = mysql_query("UPDATE users SET status='online' WHERE email='$email'", $dbh2);
?>
}}})()
</script>