**How to update table on session timeout**
$_SESSION['start'] = time();
$_SESSION['expire'] = $_SESSION['start'] + (1 * 60);
if (isset($_SESSION['Seats']))
{
**if session start then update first query**
$seatS=$_SESSION['Seats'];
$Eventid=$_POST["Eventid"];
$stmt = $con->prepare('UPDATE fistevent SET `Status`="Hold" where `Event_Id`=? AND `seats`="'.$seatS.'" ');
$stmt->bind_param("s", $_POST["Eventid"]);
$stmt->execute();
else
{
$now = time();
**check current time and if session time is over update second query**
if ($now > $_SESSION['expire']) {
session_destroy();
$seat=$_POST['finalSeats'];
$Eventid=$_POST["Eventid"];
**sql Injection Protect**
$ stmt = $ con> prepare('UPDATE fistevent SET Status
=“”其中Event_Id
=?AND seats
=“'。$ seat。'”AND { {1}} =“保持”');
$ stmt-> bind_param(“s”,$ _POST [“Eventid”]);
$ stmt->执行();