cara menambahkan data sesi ke dalam database mysql dari tombol

$conn = Connect(); //your MySQLDB connection

// extract values from session to variables
$username= $conn->real_escape_string($_SESSION['auth_user']['username']);
$email= $conn->real_escape_string($_SESSION['auth_user']['email']);
$phone= $conn->real_escape_string($_SESSION['auth_user']['phone']);

//query execution
$query = $conn->prepare("INSERT into loginDetails(username,email,phone) VALUES (?, ?, ?)");
$query->bind_param("sss", $username, $email, $phone); 
$query->execute();
SAMER SAEID