Ver Mensaje Individual
  #19 (permalink)  
Antiguo 04/05/2012, 16:02
Avatar de BLAH !!
BLAH !!
 
Fecha de Ingreso: septiembre-2003
Ubicación: Región Metropolitana, Santiago, Chile
Mensajes: 706
Antigüedad: 20 años, 7 meses
Puntos: 16
Respuesta: borrado de un registro

CREO QUE ESTO ES MEJOR QUE TU CEBRA !

Código PHP:
<?php
   
include ("config.php");
if(
$_GET['action']=="delete"){
$id$_GET['id'];
 
$delete "DELETE FROM usuarios WHERE id='$id'";
 
$del mysql_query($delete) or die (mysql_error());
 
$opt "OPTIMIZE TABLE usuarios";
 
$rop mysql_query($opt);
};
?> 

<html>
<head>

<SCRIPT>
function show_confirm(id){
 var r=window.confirm("Estas seguro de borrar este registro?");
 if (r==true){
  window.location="archivo.php?action=delete&id="+id;
 }else{
  alert("Ha cancelado!");
 }
}
</SCRIPT> 

<title>registros</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="contenido">
  <div id="cabecera"></div>
  <div id="separacion"></div>
  
<?php
 $estilo
=array("a","b");  
$contador=0;  
     
$result=mysql_query("SELECT * FROM usuarios ORDER BY id",  $conexion);
     While (
$row=mysql_fetch_array ($result)){
$contador++;  
?>


  <div class="<?php echo "".$estilo[$contador%2].""?>">
  <?php echo '<table width="596" border="0">
      <tr>
        <td width="58">".$row[0]."</td>
        <td width="142">".$row[1]."</td>
        <td width="125">".$row[1]."</td>
        <td width="117">".$row[3]."</td>
        <td width="120"><a style="cursor:pointer; cursor: hand;" onClick="show_confirm(\'".$row[id]."\')"><img alt="Show a confirm box"  src="delete-32.png" width="16" height="16"></a></td>
        <td width="160">  </td>
      </tr>
    </table>
  </div>'
;
  
  } 
 
?>
<p>&nbsp;</p>
</div>
</body>
</html>
__________________
Adios ...!!!!