Ver Mensaje Individual
  #16 (permalink)  
Antiguo 13/04/2009, 20:20
dasa
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años, 10 meses
Puntos: 8
Respuesta: Eliminacion checkbox Dreamweaver

Gracias de nuevo, ya hice lo que me dices y tengo lo siguiente:

Código PHP:
Ver original
  1. <?php require_once('Connections/farmacia.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.  
  8.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  9.  
  10.   switch ($theType) {
  11.     case "text":
  12.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  13.       break;    
  14.     case "long":
  15.     case "int":
  16.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  17.       break;
  18.     case "double":
  19.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  20.       break;
  21.     case "date":
  22.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  23.       break;
  24.     case "defined":
  25.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  26.       break;
  27.   }
  28.   return $theValue;
  29. }
  30. }
  31.  
  32. if ((isset($_GET['eliminar'])) && ($_GET['eliminar'] != "")) {
  33.   $deleteSQL = sprintf("DELETE FROM factura_ingreso WHERE Id=%s",
  34.                        GetSQLValueString($_GET['eliminar'], "int"));
  35.  
  36.   mysql_select_db($database_farmacia, $farmacia);
  37.   $Result1 = mysql_query($deleteSQL, $farmacia) or die(mysql_error());
  38. }
  39.  
  40. $maxRows_listaringreso = 10;
  41. $pageNum_listaringreso = 0;
  42. if (isset($_GET['pageNum_listaringreso'])) {
  43.   $pageNum_listaringreso = $_GET['pageNum_listaringreso'];
  44. }
  45. $startRow_listaringreso = $pageNum_listaringreso * $maxRows_listaringreso;
  46.  
  47. mysql_select_db($database_farmacia, $farmacia);
  48. $query_listaringreso = "SELECT * FROM factura_ingreso";
  49. $query_limit_listaringreso = sprintf("%s LIMIT %d, %d", $query_listaringreso, $startRow_listaringreso, $maxRows_listaringreso);
  50. $listaringreso = mysql_query($query_limit_listaringreso, $farmacia) or die(mysql_error());
  51. $row_listaringreso = mysql_fetch_assoc($listaringreso);
  52.  
  53. if (isset($_GET['totalRows_listaringreso'])) {
  54.   $totalRows_listaringreso = $_GET['totalRows_listaringreso'];
  55. } else {
  56.   $all_listaringreso = mysql_query($query_listaringreso);
  57.   $totalRows_listaringreso = mysql_num_rows($all_listaringreso);
  58. }
  59. $totalPages_listaringreso = ceil($totalRows_listaringreso/$maxRows_listaringreso)-1;
  60. ?><html>
  61. <head>
  62. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  63. <title>Documento sin t&iacute;tulo</title>
  64. </head>
  65.  
  66. <body>
  67. <form id="form1" name="form1" method="post" action="">
  68. <table border="1">
  69.   <tr>
  70.     <td>Id</td>
  71.     <td>numfactura</td>
  72.     <td>nombre</td>
  73.     <td>cantidad</td>
  74.     <td>fecha</td>
  75.     <td>precio</td>
  76.     <td>iva</td>
  77.     <td>proveedor</td>
  78.     <td>Eliminar</td>
  79.   </tr>
  80.   <?php do { ?>
  81.     <tr>
  82.       <td><?php echo $row_listaringreso['Id']; ?></td>
  83.       <td><?php echo $row_listaringreso['numfactura']; ?></td>
  84.       <td><?php echo $row_listaringreso['nombre']; ?></td>
  85.       <td><?php echo $row_listaringreso['cantidad']; ?></td>
  86.       <td><?php echo $row_listaringreso['fecha']; ?></td>
  87.       <td><?php echo $row_listaringreso['precio']; ?></td>
  88.       <td><?php echo $row_listaringreso['iva']; ?></td>
  89.       <td><?php echo $row_listaringreso['proveedor']; ?></td>
  90.       <td><div align="center">
  91.           <input type="checkbox" name="seleccion[]" value="<?php echo $row_listaringreso['Id']; ?>" />
  92.           </div></td>
  93.     </tr>
  94.     <?php } while ($row_listaringreso = mysql_fetch_assoc($listaringreso)); ?>
  95. </table>
  96. <p>
  97.   <label for="eliminar"></label>
  98.   <input type="submit" name="eliminar" id="eliminar" value="Borrar" />
  99. </p>
  100. </form>
  101. </body>
  102. </html>
  103. <?php
  104. mysql_free_result($listaringreso);
  105. ?>

Esperando ansiosamente el siguiente paso.

Muchas gracias por tu tiempo.