So I am not able to find out about an exclusion code where it contains a condition. If it is a registered course, if it is a foreign key in the user table, it can not be excluded from the course table.
I will leave the print of the tables below and the exclusion code that is not receiving the value, if anyone can help I will be grateful.
Here is the exclude code:
<?php
include "../includes/conexao.php";
$idcurso = $_GET['idcurso'];
$curso = $_GET['curso'];
$usuario = $_GET['usuario'];
$consulta = mysqli_query("SELECT * FROM usuario WHERE curso = $curso");
$numregistros = mysqli_num_rows($consulta);
if($numregistros == "0") {
$sql ="DELETE FROM curso where idcurso = $idcurso";
} else {
echo "<script> alert ('Não foi possível deletar pois se encontra cadastrado um nome ao curso desejado a exclusão:'); location.href='curso.php';</script>";
}
Below is the print of the tables.