Commit 85b41f45 authored by sam.markey's avatar sam.markey

BookingID PHP Script

parent fc7106bb
<?php
if(isset($_POST['bookingID'])){
$bookingID = htmlspecialchars($_POST['bookingID']);
while(true){
require_once "connect_db.php";
$sql = 'SELECT * FROM receipt_museum WHERE bookingID= ?;';
$stmt = mysqli_stmt_init($connect);
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo 'failure';
} else {
mysqli_stmt_bind_param($stmt, "i", $bookingID);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if (mysqli_fetch_assoc($result)) {
$bookingID = mt_rand(100000,999999);
}
else {
break;
}
}
}
mysqli_stmt_close($stmt);
echo $bookingID;
} else{
echo 'no submit';
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment