
problema al insertar registro
Publicado por NIKOTINA (18 intervenciones) el 27/03/2007 16:10:19
Hola a todos. tengo un problema (soy nuevo en php). resulta que quiero ingresar unos datos (dni) en una tabla en my sql pero no lo inserta.
el codigo es el siguiente:
htlm>
<head>
<title>EJEMPLO DE CONEXION </title>
</head>
<body>
<?
function conectarse()
{
if (!($link=mysql_connect("localhost","root","")))
{
echo "error1";
exit();
}
if (!mysql_select_db("universidad",$link))
{
echo "error2";
exit();
}
return $link;
}
conectarse();
echo "exito";
?>
</body>
</htlm>
<html>
<?
include("conectarse.php");
$link=conectarse();
$sql= "delete from alumnos where dni =$doc";
mysql_query($sql,$link);
//header("Location:transaccion_alumnos.php");
?>
</html>
html>
<head>
<title> transaccion alumnos </title>
</head>
<body>
<form action = "reg_alumn_online.php">
<hr>
<br>
DNI:
<input type ="text" name ="doc"><br><br>
<br>
<hr>
<input type="reset" name ="accion" value="ACEPTAR">
</form>
</body>
</html>
si alguien me puede indicar en que me estoy equivovando se lo voy a agradecer.
el codigo es el siguiente:
htlm>
<head>
<title>EJEMPLO DE CONEXION </title>
</head>
<body>
<?
function conectarse()
{
if (!($link=mysql_connect("localhost","root","")))
{
echo "error1";
exit();
}
if (!mysql_select_db("universidad",$link))
{
echo "error2";
exit();
}
return $link;
}
conectarse();
echo "exito";
?>
</body>
</htlm>
<html>
<?
include("conectarse.php");
$link=conectarse();
$sql= "delete from alumnos where dni =$doc";
mysql_query($sql,$link);
//header("Location:transaccion_alumnos.php");
?>
</html>
html>
<head>
<title> transaccion alumnos </title>
</head>
<body>
<form action = "reg_alumn_online.php">
<hr>
<br>
DNI:
<input type ="text" name ="doc"><br><br>
<br>
<hr>
<input type="reset" name ="accion" value="ACEPTAR">
</form>
</body>
</html>
si alguien me puede indicar en que me estoy equivovando se lo voy a agradecer.
Valora esta pregunta


0