Embed presentation
Download to read offline
![<?php
mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("cep" ) or die(mysql_error());
$id=$_GET['id'];
mysql_query("delete from matricula where DNI='$id'");
mysql_query("delete from alumnes where DNI='$id'");
echo mysql_errno();
header("Location: borraralumnos.php");
?>](https://image.slidesharecdn.com/borrados-140527044400-phpapp02/75/Borrados-1-2048.jpg)
This PHP script connects to a MySQL database named "cep" and deletes a record from the "matricula" table and "alumnes" table where the "DNI" field equals the "id" variable passed in the URL, then redirects the page to "borraralumnos.php" after deletion.
![<?php
mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("cep" ) or die(mysql_error());
$id=$_GET['id'];
mysql_query("delete from matricula where DNI='$id'");
mysql_query("delete from alumnes where DNI='$id'");
echo mysql_errno();
header("Location: borraralumnos.php");
?>](https://image.slidesharecdn.com/borrados-140527044400-phpapp02/75/Borrados-1-2048.jpg)