![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
07/12/2007, 10:08
|
| | Fecha de Ingreso: diciembre-2007
Mensajes: 34
Antigüedad: 17 años, 2 meses Puntos: 0 | |
Eliminar Registros Con Checkbox HOLA ES MI PRIMER CONSULTA
QUIERO BORRAR UNOS REGISTROS DE UNA TABLA DE UNA BASE DE DATOS A PARTIR DE LA SELECCION DE UN CHECK BOX, LEI EL POST QUE HAY AQUI PERO NO OCURRE EL BORRADO NO SE EN QUE ME HE EQUIVOCADO ESPERO ME PUEDAN AYUDAR DE ANTEMANO GRACIAS.
INCLUYO EL CODIGO QUE OCUPO
PAGINA2.PHP
sq = "SELECT * FROM temporal WHERE numero_control='$numcon' ";
$result=mysql_query($sq);
echo "<table border = '1'> \n";
echo "<tr> \n";
echo "<td></td>";
echo "<td><b>CLAVE</b></td> \n";
echo "<td><b>MATERIA</b></td> \n";
echo "<td><b>HORA</b></td> \n";
echo "<td><b>DIA</b></td> \n";
echo "<td><b>MAESTRO</b></td> \n";
echo "</tr> \n";
echo "<form action=\"borratodmat.php\" method=\"post\"> \n";
while ($row = mysql_fetch_row($result)){
echo "<tr> \n";
echo "<td> \n";
echo "<input type=\"checkbox\" name=\"seleccion[]\" value=\"".$row['cve_grupo']."\">".$row['materia']."<br>";
}
?>
<?php
echo "<td>$row[5]</td> \n";
echo "<td>$row[1]</td> \n";
echo "<td>$row[6]</td> \n";
echo "<td>$row[7]</td> \n";
echo "<td>$row[3]</td> \n";
echo "</tr> \n";
/*
$cvemat=$row[1];
$nomae=$row[3];
$cvegrupo=$row[6];
$var=$var++;
*/
echo "</table> \n";
echo "<table> \n";
echo "<tr> \n";
echo "<td> \n";
echo "<input type=\"submit\" name=\"Submit\" value=\"BORRAR\">";
echo "</form>";
echo "</td> \n";
echo "</tr> \n";
echo "</table> \n";
?>
BORRARTODMAT.PHP
<?PHP
$lista=implode(",",$_POST['seleccion']);
// Y lo aplicamos al SQL correspondiente y ejecutamos la consulta.
mysql_query("DELETE FROM temporal WHERE cve_grupo IN((".$lista."))");
?> |