este scrip de php,realiza el borrado de una tabla
tiene un problema con el $id=$_GET['codigo'];
ademas quiero actualizar el registro de la misma forma del borrado?
<html>
<head>
<title>Ejemplo de PHP</title>
</head>
<body>
<H1>Ejemplo de uso de bases de datos con PHP y MySQL</H1>
<?php
$conexion = mysql_connect("equipo", "root", "");
if (! $conexion)
{
echo "<h2 align='center'>ERROR: Imposible establecer conexión con el servidor</h2>";
exit;
}
mysql_select_db("basededatos", $conexion);
$result=mysql_query("select * from usuario",$conexion);
?>
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR><TD> <B>Nombre</B></TD> <TD> <B>Apellidos</B> </TD> <TD> <B>Borrar</B> </TD></TR>
<?php
while($row = mysql_fetch_array($result)) {
printf("<tr><td> %s</td><td> %s </td><td><a href=\"borrarb1.php\">Borra</a></td></tr>", $row[0],$row[1],$row["codigo"]);
}
mysql_free_result($result);
mysql_close($conexion);
?>
</table>
</body>
</html>
el otro programa borrar b1.php es:
$conexion = mysql_connect("equipo", "root", "");
if (! $conexion)
{
echo "<h2 align='center'>ERROR: Imposible establecer conexión con el servidor</h2>";
exit;
}
mysql_select_db("basededatos", $conexion);
$id=$_GET['codigo'];
mysql_query("delete from prueba where codigo = $id",$conexion);
?>
gracias por la colaboracion
![Stress](http://static.forosdelweb.com/fdwtheme/images/smilies/stress.png)