Firstly, your condition is wrong. You are not checking if $room_number equals 1, but you are assigning string "1" to that variable. You need 2 = symbols to do a compare, or 3 = for strict comparisson. Please read more about this here: http://php.net/manual/en/language.operators.comparison.php
Secondly, you need to adapt your logic. You are checking if room number equals 1, then in else block check if room number is not 1, redundant check. The else will be executed only if room number is not equal 1, so no need to check this again. And then at the end, you execute the query regardless of the $room_number value. Move that bottom if, into the body of the first if. Like so:
<?php
if ($room_number === "1") {
$mysql_qry = "insert into patients2
(patient_name, doctor_name, check_in_date, room_number, bed_number, notes, time)
values ('$patient_name', '$doctor_name', '$check_in_date', '$room_number', '$bed_number', '$notes', '$time')";
if($conn->query($mysql_qry) === TRUE) {
echo "Insert successful";
} else {
echo "Error: " . $mysql_qry . "<br>" . $conn->error;
}
} else {
echo "Room number does not equal 1";
}
Now, we check if the $room_number is string("1"), and if it is, we create the query and execute it. If execution was successful we print the success message, or the query error otherwise. If the $room_number is not exactly "1" we display an error message about it.
$room_number == '1', = is assigment operator