Código PHP:
<?php
$conexio=mysql_connect("localhost","root","");
mysql_select_db("parc_atraccions",$conexio);
$baixa=$_POST['esborra'];
$DNI=$_POST['DNI'];
$Nom=$_POST['Nom'];
$Cognom=$_POST['Cognom'];
$ver=$_POST['verificar'];
if (isset($_POST["esborra"])){
$resultat=mysql_query("DELETE from treballadors WHERE DNI=$DNI",$conexio);
$files=mysql_affected_rows($conexio);
if (mysql_errno($conexio)==0){
echo "<center><h2> FILES ELIMINADES: $files</h2></center>";
echo "<br>";
}
else
{
$numeroerror=mysql_errno($conexio);
$descripcioerror=mysql_error ($conexio);
echo "num_derror $numeroerror";
echo "<br>";
echo "descripcio $descripcioerror";
}
}
//if($_POST["submit"]=="verificar"){
if (isset($_POST["verificar"])){
$resultat=mysql_query("SELECT Nom,Cognom from treballadors WHERE DNI='$DNI'",$conexio);
$numero=mysql_num_rows($resultat);
if (mysql_errno($conexio)!=0){
echo "<center><h2> Error al fer el select</h2></center>";
exit();
}
if(mysql_query($sql)){
echo "<center><h2> No existeix cap treballador amb aquest DNI </h2></center>";
exit();
}
else {
$fila=mysql_num_rows($resultat);
echo" Nom del treballador:".$_POST['Nom'];
echo "<br>";
echo "Cognom: ".$_POST['Cognom'];
//echo" Nom del treballador: '".$_POST['Nom']."'";
//echo "Cognom:'".$_POST['Cognom']."'";
}
}
exit();
mysql_close();
?>