Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/09/2010, 14:32
Avatar de oscarios
oscarios
 
Fecha de Ingreso: septiembre-2004
Mensajes: 186
Antigüedad: 19 años, 8 meses
Puntos: 2
Eliminar varios registros al tiempo

hola buenas tardes amigos del foro, recurro a ustedes esta vez para su ayuda con lo siguiente.
necesito eliminar registros de una tabla de mysql que se encuentren entre dos fechas, para ello ya tengo el buscador con fecha inicial y fecha final, ahi mismo me muestra la lista de registros que cumplen esa consulta dentro de un form , cada registro tiene un checkbox que envia el id de cada registro.
hasta ahi todo bien pero no se que hacer de ahi en adelante no se nada de php y lo que hago es gracias al DREAMWEAVER CS4, he leido mucho por internet algunas posibles rutinas para el scrip de la pagina de eliminacion pero no logro entender y no me sale nada.

de antemano gracias por su valiosa ayuda

ESTE ES MI CODIGO

Código PHP:
Ver original
  1. <?php require_once('Connections/conbanca.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $colname_Recordset1 = "-1";
  35. if (isset($_GET['busca1'])) {
  36.   $colname_Recordset1 = $_GET['busca1'];
  37. }
  38. $colname2_Recordset1 = "-1";
  39. if (isset($_GET['busca2'])) {
  40.   $colname2_Recordset1 = $_GET['busca2'];
  41. }
  42. mysql_select_db($database_conbanca, $conbanca);
  43. $query_Recordset1 = sprintf("SELECT * FROM inmuebles WHERE fecha BETWEEN %s AND %s", GetSQLValueString($colname_Recordset1, "date"),GetSQLValueString($colname2_Recordset1, "date"));
  44. $Recordset1 = mysql_query($query_Recordset1, $conbanca) or die(mysql_error());
  45. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  46. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  47. ?>
  48. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  49. <html xmlns="http://www.w3.org/1999/xhtml">
  50. <head>
  51. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  52. <title>Documento sin título</title>
  53. </head>
  54.  
  55. <body>
  56. <form id="form1" name="form1" method="get" action="masivo1.php">
  57. Fecha del
  58.   <label for="busca1"></label>
  59.   <input type="text" name="busca1" id="busca1" />
  60. al
  61. <label for="busca2"></label>
  62. <input type="text" name="busca2" id="busca2" />
  63. <label for="button"></label>
  64. <input type="submit" name="button" id="button" value="Enviar" />
  65. </form>
  66. <p>&nbsp;</p>
  67. <hr />
  68. <p>&nbsp;</p>
  69. <form action="masivo2.php" method="post" name="form2" id="form2">
  70.   <table width="40%" border="0" cellspacing="0" cellpadding="3">
  71.     <tr>
  72.       <td bgcolor="#D6D6D6">ID</td>
  73.       <td bgcolor="#D6D6D6">CODIGO INMUEBLE</td>
  74.       <td bgcolor="#D6D6D6">CODIGO METRO</td>
  75.       <td bgcolor="#D6D6D6">USUARIO</td>
  76.       <td bgcolor="#D6D6D6">&nbsp;</td>
  77.     </tr>
  78.     <?php do { ?>
  79.       <tr>
  80.         <td><?php echo $row_Recordset1['id']; ?></td>
  81.         <td><?php echo $row_Recordset1['codigo_inm']; ?></td>
  82.         <td><?php echo $row_Recordset1['Cod_Metro']; ?></td>
  83.         <td><?php echo $row_Recordset1['usuario']; ?></td>
  84.         <td><input name="campos[]" type="checkbox" value="<?php echo $data['id']; ?>" />
  85.         <label for="idcat[]"></label></td>
  86.       </tr>
  87.       <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  88.   </table>
  89.   <p>
  90.     <label for="button2"></label>
  91.     <input type="submit" name="button2" id="button2" value="ELIMINAR" />
  92.   </p>
  93. </form>
  94. <p>&nbsp;</p>
  95. </body>
  96. </html>
  97. <?php
  98. mysql_free_result($Recordset1);
  99. ?>
__________________
oscariosdw