Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/03/2006, 17:45
gingerk
 
Fecha de Ingreso: enero-2006
Mensajes: 140
Antigüedad: 18 años, 3 meses
Puntos: 0
borrar registros

mi base de datos se llama videoteca, la tabla genero y dentro de genero esta id, nombre, descripcion


tengo dos paginas php la primera llama a la segunda.

la 1ª
Código PHP:
<html>
<head>
<title> mostrar, añadir, borrar registros</title>
</head>
<body>
<p><h3>Borrar registros</h3>

<?php

//contiene dos paginas registros.php y registros2.php
//conexion con mysql
$conexion=mysqli_connect('localhost','root','','videoteca') ;

//comprobacion conexion
//si la conexion no es valida
if($conexion==FALSE){
  echo 
'error en la conexion';
}
//creamos formulario
echo '<FORM METHOD="POST" ACTION="registros2.php">ID<br>';
//conexion con la tabla genero
$result=mysqli_query(
    
$conexion,
    
'SELECT id FROM genero ORDER BY id ');

echo 
'<select name="id">';


//Mostramos los registros en forma de menú desplegable
while ($row=mysqli_fetch_array($result)){
  echo 
'<option>'.$row["id"];}
mysqli_free_result($result)
?>
</select>

<br>
<INPUT TYPE="SUBMIT" value="Borrar">
</FORM>
</body>
</html>
la 2ª
Código PHP:
<html>
<head>
<title> mostrar, añadir, borrar registros</title>
</head>
<body>
<p>

<?php

//contiene dos paginas registros.php y registros2.php
//conexion con mysql
$conexion=mysqli_connect('localhost','root','','videoteca') ;

//comprobacion conexion
//si la conexion no es valida
if($conexion==FALSE){
  echo 
'error en la conexion';
}

//conexion con la tabla genero
$result=mysqli_query(
    
$conexion,
    
"Delete From genero Where id='$id'");



?>
<h1><div align="center">Registro Borrado</div></h1>
<div align="center"><a href="registros.php">Volver</a></div>
</body>
</html>

mo me borra los registros, por que? cual es el error?