Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/08/2004, 15:44
catrin
 
Fecha de Ingreso: julio-2003
Mensajes: 53
Antigüedad: 20 años, 8 meses
Puntos: 0
Estoy trabajando en php, lo más probable es que tengas razon con eso de propagar la id.....que es más complicado que borrar directo, por eso pedia donde ver algo de información para partir.

Mira no se pueda explicarme bien, ojalá me entiendas.
Tengo una pagina que despliega el total de los datos de mi base de datos,

<HTML>
<HEAD>
<TITLE>lecturausuarios.php</TITLE>
</HEAD>
<BODY>
<h1><div align ="center">Ususarios registrados</div></h1>
<br>
<br>
<?
//coneccion a la base de datos
mysql_connect("localhost","root","root");
//ejecutamos sentencia sql
$resul=mysql_db_query("gestion","select * from password");
?>
<table align ="center" border="2" bordercolor="blue">
<tr>
<th>Nombre</th>
<th>Apellidos</th>
<th>Rut</th>
<th>Login</th>
<th>Password</th>
<th>E- mail</th>
<th>General</th>
<th>Administracion</th>
<th>Recaudación</th>
<th>Abastecimiento</th>
<th>Ingenieria</th>
<th>SSGG</th>
<th>Gerencia</th>


Despues cuando aprieto borrar registros me muestra una pagina con una similar pero filtrada por un campo,


<HTML>
<HEAD>
<TITLE>Borrarusuarios.php</TITLE>
</HEAD>
<BODY>
<div align="center">
<h1>Borrar un registro</h1>
<br>

<?
//Conexion con la base
mysql_connect("localhost","root","root");

echo '<FORM METHOD="POST" ACTION="borra1.php">Login<br>';

//Creamos la sentencia SQL y la ejecutamos
$sSQL="Select login From password order by login ";
$result=mysql_db_query("gestion",$sSQL);

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

//Mostramos los registros en forma de menú desplegable
while ($row=mysql_fetch_array($result))
{echo '<option>'.$row["login"];

}



?>
</select>

</table>
<br>
<INPUT TYPE="SUBMIT" value="Borrar">
</FORM>
</div>

</BODY>
</HTML>


Aca es cuando quiero confirmar lo que se va a borra y no hacerlo directo..


<HTML>
<HEAD>
<TITLE>Borrar1.php</TITLE>
</HEAD>
<BODY>
<div align="center">
<h1>Registro a borrar</h1>
<br>
<?
//Conexion con la base
mysql_connect("localhost","root","root");

echo '<FORM METHOD="POST" ACTION="borrar.php"><br>';

//Creamos la sentencia SQL y la ejecutamos
$sSQL="Select * From password where login='$login'";
?>
<table align ="center" border="2" bordercolor="blue">
<tr>
<th>Nombre</th>
<th>Apellidos</th>
<th>Rut</th>
<th>Login</th>
<th>Password</th>
<th>email</th>
<th>general</th>
<th>administracion</th>
<th>Recaudación</th>
<th>Abastecimiento</th>
<th>Ingenieria</th>
<th>SSGG</th>
<th>Gerencia</th>


<?
$result=mysql_db_query("gestion",$sSQL);
while ($row=mysql_fetch_array($result))
{
echo '<tr><td>'.$row ["nombre"].'</td>';
echo '<td>'.$row ["apellidos"].'</td>';
echo '<td>'.$row ["rut"].'</td>';
echo '<td>'.$row ["login"].'</td>';
echo '<td>'.$row ["password"].'</td>';
echo '<td>'.$row ["email"].'</td>';
echo '<td>'.$row ["general"].'</td>';
echo '<td>'.$row ["administracion"].'</td>';
echo '<td>'.$row ["gestionadrec"].'</td>';
echo '<td>'.$row ["gestionabastecimiento"].'</td>';
echo '<td>'.$row ["gestioningenieria"].'</td>';
echo '<td>'.$row ["gestionssgg"].'</td>';
echo '<td>'.$row ["presupuestogerencia"].'</td></tr>';
}

mysql_free_result($result)
?>

</table>
<br>
<INPUT TYPE="SUBMIT" value="Borrar">
</FORM>
</div>

</BODY>
</HTML>


y finalmente debería borra el registro

<HTML>
<HEAD>
<TITLE>Borrar.php</TITLE>
</HEAD>
<BODY>
<?
//Conexion con la base
mysql_connect("localhost","root","root");

//Creamos la sentencia SQL y la ejecutamos
$sSQL="Delete From password Where login='$login'";
mysql_db_query("gestion",$sSQL);
?>

<h1><div align="center">Registro Borrado</div></h1>
<div align="center"><a href="lecturausuarios2.php">Visualizar el contenido de la base</a></div>

</BODY>
</HTML>



Espero me entiendan.....yo se que el sistema debe estar remalo, estoy intentando aprender, ojalá puedan guiarme.