Make an alert in which you can not modify the fields of a crud

0

Good evening I was doing an exercise where there is a form of low discharge and modification for clients and invoices. My doubt started since not being able to relate tables through phpmyadmin (using the wamp package), since it tells me a message that it does not support relationships, I decided Instead of the alert appearing at the time of trying to eliminate a client who had pending invoices (as the exercise says), I change it to appear if I want to delete a particular address. Then knowing that, I wanted to know if this code would be good '

$Direc=$_GET["Direc"];
	
$conexion->query("DELETE FROM cliente WHERE Direccion='$Direc'");
if($Direc="estoesloquenopuedepir"){	
echo'<script type="text/javascript">
        alert("Tarea Guardada");
        window.location.href="index.php";
        </script>';
}

'

    
asked by Santi Corso 15.10.2017 в 07:12
source

2 answers

1

In mysql the tables must be innodb to be able to relate them, the myisan tables do not support relations, in phpmyadmin if it is possible to make the relations if both tables are innodb.

Regarding what you ask.

Before executing the client's delete, it makes a query in the invoices table to verify if the client has an invoice. if you get results print the message and do not continue with the execution of the program.

    
answered by 19.10.2017 / 15:50
source
0

to be able to relate tables in mysql you can use mysqlworbech and then move the base to your phpmyadmin by establishing connection or generating a query.

but the alert you are making is correctly programmed

    
answered by 15.10.2017 в 10:16