Ver Mensaje Individual
  #4 (permalink)  
Antiguo 09/03/2012, 13:52
rimox
 
Fecha de Ingreso: marzo-2012
Mensajes: 17
Antigüedad: 13 años
Puntos: 0
Respuesta: borrar datos de una tabla mysql

este es el codigo borra.php

Cita:
<?php
include("conec.php");
$link=Conectarse();
mysql_query("delete from ligascenso where id = ".$_GET["id"],$link);
header("Location: formelimina.php");
?>
este el el codigo formelimina.php

Cita:
<html>
<head>
<title>Ejemplo de PHP</title>
</head>
<body>
<h1><center>Eliminar Equipos</center></h1>
<?php

$link = mysql_connect("localhost", "root", "");

mysql_select_db("proevo", $link);

$result = mysql_query("SELECT id, id_equipo FROM ligascenso ;", $link);

if ($row = mysql_fetch_array($result)){

echo "<table align='center' border = '1' >";

echo "<tr>";

echo "<td width='50' align='center'><b>ID</b></td>";
echo "<td width='200' align='center' ><b>Equipo</b></td>";
echo "<td width='50' align='center'><b>Eliminar</b></td>";


echo "</tr>";

do {

echo "<tr>";

echo "<td align='center'>".$row["id"]."</td>";

echo "<td align='center'>".$row["id_equipo"]."</td>";

echo "<td align='center'><a href=\"borra.php?id=%d\"> Borra </a></td></tr>";




echo "</tr>";


} while ($row = mysql_fetch_array($result));
} else {

echo "¡ La base de datos está vacia !";

}

?>



</td> </tr>
</table>

</body>
</html>
y este es el archivo conec.php

Cita:
<?php
function Conectarse(){
if (!($link=mysql_connect("localhost","root",""))) {
exit();
}
if (!mysql_select_db("proevo",$link)){
exit();
}
return $link;
}
?>