I have a php code as shown below in which there is an if condition.
php:
if(mysqli_num_rows($result1) > 0){   // Line X
    while($row = mysqli_fetch_array($result1)){
        if($row['open'] == "true") {
                if(!isset($_SESSION['admin'])) {
                    $message = "user " . $row['user_name'] . " is currently editing the form. Want to take over ?";  // Line B
                    echo "<script type='text/javascript'>if(confirm('$message')) {   } else {  };</script>";   // Line A                        
                    }
            break;
        }
    }
}
I was able to integrate $message at Line B.
I am wondering what changes I should do at Line A so that I can integrate the following code in the curly braces of the if(confirm('$message') block:
$username = $_SESSION['user_name'];
$open="true";
$write="1";
$stmt=$connect->prepare("UPDATE trace_users SET write=0 WHERE write=1"); // revoke write access of all users
$stmt=$connect->prepare("UPDATE trace_users SET open=?, write=? WHERE user_name=?");
$stmt->bind_param('sss', $open, $write, $username);
$stmt->execute();
 
     
    