Limit specific data that goes into database

  database, php, sql

I’m just want to ask how I can limit the data that goes into my database I have this code where I insert the data in from into my database. But what I want to do is to limit the data. This is a hotel reservation form by the way, so anyways for example I have only 5 spot in a one specific room for instance "Single room" if that 5 spot has been booked the other guest cannot book with that room anymore because it’s fully booked, unless the admin deleted the previous records, Thank in advance.

 $lastname = $_POST['lname'];
     $firstname = $_POST['fname'];
     $email = $_POST['email'];
     $cont = $_POST['contact'];
     $RoomType = $_POST['RoomType'];
     $adult = $_POST['adult'];
     $children = $_POST['children'];
     $arrivalDate = $_POST['arrival_date'];

      $sql = "INSERT INTO guests(lastname, firstname, email, contact, room_type, adult_guest, children_guest, date_of_arrival)
        VALUES ( '$lastname', '$firstname', '$email', '$cont', '$RoomType', '$adult', '$children', '$arrivalDate')";

          if(mysqli_query($con, $sql)){
                echo "<script language = 'javascript'>alert('Your Record has been inserted')</script>";
                echo "<script>window.location.href='dashboard.php';</script>";
               else {
                echo "error".$sql."<br>".mysqli_error($con);

Source: Ask PHP