I am new to PHP and I am trying to check if there is an equal registration in the database before registering, but so far, the problem is that I can not verify with 3 conditions in WHERE SELECT ex:
SELECT * FROM datashowreserva
WHERE DATASHOW = '{$datashow}' AND
DATA_RESERVA = '{$data_reserva}' AND
HORARIO_RESERVA = '{$horario_reserva}'
The select itself works because I tested it in mysql, it's the program in php that I think is wrong.
Below is what I've tried:
$datashow = $_SESSION['select_datashow'];
$data_reserva = $_SESSION['data_reserva_datashow'];
$horario_reserva = $_SESSION['select_horario_reserva_datashow'];
$sql_code_select = "SELECT * FROM datashowreserva WHERE DATASHOW = '{$datashow}' AND DATA_RESERVA = '{$data_reserva}' AND HORARIO_RESERVA = '{$horario_reserva}'";
$sql_query = mysqli_query($server_mysql,$sql_code_select);
if (mysqli_num_rows($sql_query) > 0) {
echo "<script language='javascript' type='text/javascript'>alert('Essa reserva já existe.');window.location.href='Cadastrar_Datashow.php';</script>";
}