I am creating a functionality called tentative booking.
When a user books a ticket, he is given a temporary pnr-number and he should be given about 10 minutes to perform his payment.
If he fails to pay within 10 minutes, the transaction should be cancelled. Otherwise a success-message should be displayed.
Please ignore the logic for the payment. It can be any method.
I'm generating the temporary pnr-number and storing it into the database.
I can't understand how should I proceed here.
Is there any functionality in php which I can use for this?
Here is my code :
$pnr = getPnr();
echo "You temporarary pnr num is : $pnr <br>";
echo "Check you mail and save it for future use";
if($book_ticket == 'true')
{ DoTentativeBooking($userid,$book_ticket,$from,$to,$date,$pnr,$seats,$email);
}
function DoTentativeBooking($userid,$book_ticket,$from,$to,$date,$pnr,$seats,$email)
{
$con = mysqli_connect('server', 'user', 'password', 'database');
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
return;
}
$insertQuery1 = "INSERT INTO tbl_user(`user_id`,`book_ticket`,`from`,`to`,`date`,`user_pnr`,`seat`,`email`,`isConfirm`) VALUES ('".$userid."','".$book_ticket."','".$from."','".$to."','".$date."','".$pnr."','".$seats."','".$email."','No')";
if (!mysqli_query($con,$insertQuery1))
{
// die('Error: ' . mysqli_error($con));
echo "error";
}
return;
}