Foros del Web » Programando para Internet » PHP »

sentencia DELETE para aplicarlo en varias tablas

Estas en el tema de sentencia DELETE para aplicarlo en varias tablas en el foro de PHP en Foros del Web. Buen día necesito de su ayuda necesito eliminar registros de 3 tablas pero al dalre eliminar me aparece un problemita diciendo undefined offset... he leido ...
  #1 (permalink)  
Antiguo 21/04/2015, 11:11
 
Fecha de Ingreso: febrero-2015
Mensajes: 35
Antigüedad: 9 años, 2 meses
Puntos: 0
sentencia DELETE para aplicarlo en varias tablas

Buen día necesito de su ayuda
necesito eliminar registros de 3 tablas pero al dalre eliminar me aparece un problemita diciendo undefined offset...
he leido keso trata de que en el fetch_aray no estoy definiendo bien la linea que me marca error
Código HTML:
Ver original
  1. </head>
  2. <?php
  3. include("conectar.php");
  4. $_resultado =mysql_query("SELECT cliente.nombre, cliente.apellido, ruta.zona, ruta.dia, ruta.numero, venta.fecha
  5. FROM cliente, ruta, venta");
  6. ?>
  7.     <h1>Clientes Registrados</h1>
  8.     <br>
  9.     <table border="2" color="#ccc">
  10.     <tr>
  11.         <th>Nombre</th>
  12.         <th>Apellido</th>
  13.         <th>Zona de Ditribucion</th>
  14.         <th>Dias de Distribucion</th>
  15.         <th>Numero de Ruta</th>
  16.         <th>Fecha</th>
  17.         <th>Acciones</th>
  18.     </tr>
  19.     <?php
  20.     while ($row=mysql_fetch_array($_resultado)) {
  21.     ?>
  22.     <tr>
  23.         <td><?php echo $row[0]?></td>
  24.         <td><?php echo $row[1]?></td>
  25.         <td><?php echo $row[2]?></td>
  26.         <td><?php echo $row[3]?></td>
  27.         <td><?php echo $row[4]?></td>
  28.         <td><?php echo $row[5]?></td>
  29.         <td>
  30.             <a href="borrar.php?id=<?php echo $row[6]?>"><img src="image/delete.png" title="¿Eliminar?" alt=""> </a>
  31.         </td>
  32.  
  33.     </tr>
  34.     <?php
  35.     }
  36.     ?>
  37.    
  38. </body>

y el archivo eliminar

Código PHP:
Ver original
  1. <?php
  2. $id = $_GET["id"];
  3. include("conectar.php");
  4. if(mysql_query("DELETE cliente,ruta FROM "))
  5.         {echo '<script type="text/javascript" >
  6. alert("Registro Eliminado");
  7. window.location="listado.php"; </script>';
  8.  
  9. }
  10. ?>

la verdad no se a que le movi, porque antes si podía elimnar de registro por registro

de ante mano gracias
  #2 (permalink)  
Antiguo 21/04/2015, 11:13
 
Fecha de Ingreso: febrero-2015
Mensajes: 35
Antigüedad: 9 años, 2 meses
Puntos: 0
Respuesta: sentencia DELETE para aplicarlo en varias tablas

el archivo borrar.php COMPLETO

<?php
$_selector=$_GET["id"];
include("conectar.php");
if(mysql_query("DELETE FROM cliente,ruta,venta,vendedor using cliente,ruta,venta,vendedor where cliente.id=ruta.id and ruta.id=venta.id and venta.id=vendedor.id"))
{
echo '<script type="text/javascript" >
alert("Registro Eliminado");
window.location="listadodepersona.php"; </script>';
}
?>

Etiquetas: delete, fecha, mysql, registro, select, sentencia, sql, tabla, tablas
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:56.