Foros del Web » Creando para Internet » Herramientas y Software »

Insertar multiples Registros

Estas en el tema de Insertar multiples Registros en el foro de Herramientas y Software en Foros del Web. HOla Me podrían explicar como puedo insertar a través de un formulario creado con DW CS3 multiples registros a una tabla que tengo en mi ...

  #1 (permalink)  
Antiguo 20/12/2010, 17:25
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Insertar multiples Registros

HOla

Me podrían explicar como puedo insertar a través de un formulario creado con DW CS3 multiples registros a una tabla que tengo en mi Base de Datos.

Gracias...
  #2 (permalink)  
Antiguo 20/12/2010, 21:30
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Si se puede??

Alguien que me ayude por favor.

Gracias
  #3 (permalink)  
Antiguo 21/12/2010, 20:21
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Se puede realizar estoooo.

Por favor alguien me ayude con esto desde Dreamweaver
  #4 (permalink)  
Antiguo 22/12/2010, 10:29
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Por favor, alguien que me pueda ayudar con esto....

O no se puede realizar con el DW
  #5 (permalink)  
Antiguo 22/12/2010, 17:00
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Necesito de su ayuda!!!, o será que no se puede desde Dreamweaver
??
  #6 (permalink)  
Antiguo 28/12/2010, 10:29
 
Fecha de Ingreso: diciembre-2010
Mensajes: 6
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Insertar multiples Registros

realizar varios registro? no entiendo llenar varias veces a tu tabla? si es asi, pues eso depende de tu programacion PHP as varios INSERT.. :D
  #7 (permalink)  
Antiguo 30/12/2010, 09:48
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Si, con un formulario que diga por ejemplo, Nombre (campo1) - Apellidos (campo2) - email (campo3), y un añadir campos o filas si desean agregar más nombres, apellidos y email, donde puedan agregar los que necesiten.

Gracias por contestar.
  #8 (permalink)  
Antiguo 04/01/2011, 09:14
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

en estos posts explico como hacer múltiples "insert" usando un loop:

http://www.forosdelweb.com/f17/array...er-php-534143/
http://www.forosdelweb.com/f17/inser...region-795227/
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #9 (permalink)  
Antiguo 06/01/2011, 00:04
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Gracias, Juaniquillo, siempre atento a estas inquietudes y sacando un poco de tu tiempo,
voy a revisar estos temas para ver como me va, cualquier cosa o inconveniente publico el codigo para que me ayude por si no fui capaz de resolver la inquietud.

Gracias Maestro.
  #10 (permalink)  
Antiguo 06/01/2011, 11:32
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Ya realice la prueba y no he podido guardar los datos como deseo, ya que no me hace nada al momento de guardarlos.

Por favor Juaniquillo SOS.

Gracias...
  #11 (permalink)  
Antiguo 06/01/2011, 11:38
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Tengo casi el mismo problema donde tengo dos paginas la primera busca y la segunda muestra resultados con un repetir región, tengo un campo de texto el cual es el que necesito llenar unicamente lo demás dejar igual sin modificar.

Realice el proceso del loop y arregle los errores que me decia pero no he podido actualizar, ya que no me guarda nada en el campo entregada.

Este es el codigo:

Cita:
<?php require_once('Connections/pailinea.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

foreach($_POST["cod_ips1"] as $key => $value){

$updateSQL = sprintf("UPDATE pedidos SET entregada=%s WHERE cod_ips=%s",
GetSQLValueString($_POST['despachada'] [$key], "text"),
GetSQLValueString($_POST['cod_ips'] [$key], "int"));

mysql_select_db($database_pailinea, $pailinea);
$Result1 = mysql_query($updateSQL, $pailinea) or die(mysql_error());

$updateGoTo = "ejebusca.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
}
$maxRows_MostrarPedido = 10;
$pageNum_MostrarPedido = 0;
if (isset($_GET['pageNum_MostrarPedido'])) {
$pageNum_MostrarPedido = $_GET['pageNum_MostrarPedido'];
}
$startRow_MostrarPedido = $pageNum_MostrarPedido * $maxRows_MostrarPedido;

$colname_MostrarPedido = "-1";
if (isset($_GET['cod_ips'])) {
$colname_MostrarPedido = $_GET['cod_ips'];
}
mysql_select_db($database_pailinea, $pailinea);
$query_MostrarPedido = sprintf("SELECT * FROM pedidos WHERE cod_ips = %s", GetSQLValueString($colname_MostrarPedido, "int"));
$query_limit_MostrarPedido = sprintf("%s LIMIT %d, %d", $query_MostrarPedido, $startRow_MostrarPedido, $maxRows_MostrarPedido);
$MostrarPedido = mysql_query($query_limit_MostrarPedido, $pailinea) or die(mysql_error());
$row_MostrarPedido = mysql_fetch_assoc($MostrarPedido);

if (isset($_GET['totalRows_MostrarPedido'])) {
$totalRows_MostrarPedido = $_GET['totalRows_MostrarPedido'];
} else {
$all_MostrarPedido = mysql_query($query_MostrarPedido);
$totalRows_MostrarPedido = mysql_num_rows($all_MostrarPedido);
}
$totalPages_MostrarPedido = ceil($totalRows_MostrarPedido/$maxRows_MostrarPedido)-1;

mysql_select_db($database_pailinea, $pailinea);
$query_ObtenerIPS = "SELECT ips.cod_ips, ips.nombre, pedidos.cod_ips FROM ips, pedidos WHERE ips.cod_ips = pedidos.cod_ips";
$ObtenerIPS = mysql_query($query_ObtenerIPS, $pailinea) or die(mysql_error());
$row_ObtenerIPS = mysql_fetch_assoc($ObtenerIPS);
$totalRows_ObtenerIPS = mysql_num_rows($ObtenerIPS);

$colname_Recordset1 = "-1";
if (isset($_GET['cod_ips'])) {
$colname_Recordset1 = $_GET['cod_ips'];
}
mysql_select_db($database_pailinea, $pailinea);
$query_Recordset1 = sprintf("SELECT cod_ips, nombre FROM ips WHERE cod_ips = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $pailinea) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<link href="estilo/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Estilo1 {color: #000000}
.Estilo2 {color: #FF0000}
.botonExcel {cursor:pointer;}
-->
</style>
</head>

<body>
<p>&nbsp;</p>

<?php if ($totalRows_MostrarPedido > 0) { // Show if recordset not empty ?>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<?php echo $row_Recordset1['nombre']; ?>
<table width="792" border="0" align="center" id="Exportar_a_Excel">
<tr>
<td width="143" class="text3"><div align="center"><span class="Estilo1">Fecha de Solicitud</span></div></td>
<td width="123" class="text3"><div align="center"><span class="Estilo1">Suministro</span></div></td>
<td width="135" class="text3"><div align="center"><span class="Estilo1">Presentación</span></div></td>
<td width="153" class="text3"><div align="center"><span class="Estilo1">Casa Productora</span></div></td>
<td width="116" class="text3"><div align="center"><span class="Estilo1">Cantidad</span></div></td>
<td width="96" class="text3"><div align="center"><span class="Estilo1">Despachada</span></div></td>
</tr>
<?php do { ?>
<tr class="text3">
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['fecha_solicitud']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['suministro']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['presentacion']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['casa_productora']; ?></div></td>
<td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['cantidad']; ?></div></td>
<td class="Estilo2"><label>
<div align="center">
<input name="despachada" type="text" class="Estilo1" id="despachada" value="<?php echo $row_MostrarPedido['entregada']; ?>" />
</div> </label></td>
</tr>
<?php } while ($row_MostrarPedido = mysql_fetch_assoc($MostrarPedido)); ?>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<label>
<input type="submit" name="registrar" id="registrar" value="Enviar" />
</label>
<input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_MostrarPedido['cod_ips']; ?>" />
<input name="cod_ips1[]" type="hidden" id="cod_ips1" value="<?php echo $despachada ?>" />
<input type="hidden" name="MM_update" value="form1" />
</form>
<?php } // Show if recordset not empty ?>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($MostrarPedido);

mysql_free_result($ObtenerIPS);

mysql_free_result($Recordset1);
?>
  #12 (permalink)  
Antiguo 06/01/2011, 12:14
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

dime como estás estructurada la tabla "pedidos" para poder recrearla en mi servidor local.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #13 (permalink)  
Antiguo 07/01/2011, 07:55
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Ok, esta de la siguiente manera:

CREATE TABLE IF NOT EXISTS `pedidos` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`cod_ips` int(12) NOT NULL,
`fecha_solicitud` varchar(12) COLLATE latin1_spanish_ci NOT NULL,
`suministro` varchar(30) COLLATE latin1_spanish_ci NOT NULL,
`presentacion` varchar(30) COLLATE latin1_spanish_ci DEFAULT '',
`casa_productora` varchar(30) COLLATE latin1_spanish_ci DEFAULT '',
`cantidad` varchar(5) COLLATE latin1_spanish_ci NOT NULL,
`entregada` varchar(6) COLLATE latin1_spanish_ci DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=7 ;


Donde necesito que actualice es solamente en entregada. Es en este campo donde solo va entrar valores

Gracias por la respuesta.
  #14 (permalink)  
Antiguo 07/01/2011, 16:41
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

aunque he recreado la base de datos no entiendo bien lo que quieres hacer. por lo que veo tienes 3 consultas en esa página. ¿Están relacionadas?
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #15 (permalink)  
Antiguo 08/01/2011, 06:01
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Gracias, las tres consultas son, una muestra la consulta de la tabla pedidos, la segunda es una consulta que muestra las instituciones, esa solo incluye un codigo y el nombre no es tan importante y la tercera es la que valida la sesion del usuario.

Lo que deseo realizar es: en el primer php hay un buscador, digitan la institucion y obtienen la busqueda de lo que digitan, al mostrar el resultado dan click sobre el y este los envia al segundo php, alli muestra por medio de una consulta lo que han pedido y el usuario que mira esa información solo va a digitar en el campo entregar lo que puede despachar o entregar, todo esta se muestra por medio de un repetir región.
El anterior codigo que te envie es del segundoo php donde se esta mostrando la consulta y deseo ingresar lo que se va a entregar a la institución y actualizar el campo entregar, pero resulta que no me realiza lo que necesito.

Gracias nuevamente. Cualquier solución es bienvenida Maestro.
  #16 (permalink)  
Antiguo 11/01/2011, 09:03
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

Ya veo. Creo que deberíamos limitarnos a lo que necesitas que es el insert múltiple solamente. Ya tengo la consulta del insert y como esta hecha la tabla pero necesito saber como es el formulario, y en este caso el formulario se genera dinámicamente. ¿Podrías pasarme un ejemplo html del formulario que usas para hacer el insert? Puedes fácilmente copiarlo del source de la página en el navegador
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #17 (permalink)  
Antiguo 11/01/2011, 15:19
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Gracias.
Anexo los dos codigos uno es el buscador y el otro lo que muestra. Hay otra tabla que es la de las instituciones en la cual el buscador consulta, y la tabla pedidos alli igualo por los id de las instituciones que requieren o piden algo
Buscador
Código PHP:
Ver original
  1. <?php require_once('Connections/pailinea.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. $maxRows_BuscarIPS = 10;
  33. $pageNum_BuscarIPS = 0;
  34. if (isset($_GET['pageNum_BuscarIPS'])) {
  35.   $pageNum_BuscarIPS = $_GET['pageNum_BuscarIPS'];
  36. }
  37. $startRow_BuscarIPS = $pageNum_BuscarIPS * $maxRows_BuscarIPS;
  38.  
  39. $colname_BuscarIPS = "-1";
  40. if (isset($_POST['nombre'])) {
  41.   $colname_BuscarIPS = $_POST['nombre'];
  42. }
  43. mysql_select_db($database_pailinea, $pailinea);
  44. $query_BuscarIPS = sprintf("SELECT cod_ips, nombre FROM ips WHERE nombre LIKE %s", GetSQLValueString("%" . $colname_BuscarIPS . "%", "text"));
  45. $query_limit_BuscarIPS = sprintf("%s LIMIT %d, %d", $query_BuscarIPS, $startRow_BuscarIPS, $maxRows_BuscarIPS);
  46. $BuscarIPS = mysql_query($query_limit_BuscarIPS, $pailinea) or die(mysql_error());
  47. $row_BuscarIPS = mysql_fetch_assoc($BuscarIPS);
  48.  
  49. if (isset($_GET['totalRows_BuscarIPS'])) {
  50.   $totalRows_BuscarIPS = $_GET['totalRows_BuscarIPS'];
  51. } else {
  52.   $all_BuscarIPS = mysql_query($query_BuscarIPS);
  53.   $totalRows_BuscarIPS = mysql_num_rows($all_BuscarIPS);
  54. }
  55. $totalPages_BuscarIPS = ceil($totalRows_BuscarIPS/$maxRows_BuscarIPS)-1;
  56. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  57. <html xmlns="http://www.w3.org/1999/xhtml">
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  60. <title>Documento sin t&iacute;tulo</title>
  61. </head>
  62.  
  63. <body>
  64. <p>&nbsp;</p>
  65. <form id="form1" name="form1" method="post" action="">
  66.   <p>Buscar
  67.     <label>
  68.     <input type="text" name="nombre" id="nombre" />
  69.     </label>
  70.   </p>
  71.   <p>
  72.     <label>
  73.     <input type="submit" name="buscar" id="buscar" value="Enviar" />
  74.     </label>
  75. </p>
  76. </form>
  77. <?php do { ?>
  78.   <p><a href="verpedidoips.php?cod_ips=<?php echo $row_BuscarIPS['cod_ips']; ?>"><?php echo $row_BuscarIPS['nombre']; ?></a></p>
  79.   <?php } while ($row_BuscarIPS = mysql_fetch_assoc($BuscarIPS)); ?></body>
  80. </html>
  81. <?php
  82. mysql_free_result($BuscarIPS);
  83. ?>

Resultado

Código PHP:
Ver original
  1. <?php require_once('Connections/pailinea.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. $maxRows_MostrarPedido = 10;
  33. $pageNum_MostrarPedido = 0;
  34. if (isset($_GET['pageNum_MostrarPedido'])) {
  35.   $pageNum_MostrarPedido = $_GET['pageNum_MostrarPedido'];
  36. }
  37. $startRow_MostrarPedido = $pageNum_MostrarPedido * $maxRows_MostrarPedido;
  38.  
  39. $colname_MostrarPedido = "-1";
  40. if (isset($_GET['cod_ips'])) {
  41.   $colname_MostrarPedido = $_GET['cod_ips'];
  42. }
  43. mysql_select_db($database_pailinea, $pailinea);
  44. $query_MostrarPedido = sprintf("SELECT * FROM pedidos WHERE cod_ips = %s", GetSQLValueString($colname_MostrarPedido, "int"));
  45. $query_limit_MostrarPedido = sprintf("%s LIMIT %d, %d", $query_MostrarPedido, $startRow_MostrarPedido, $maxRows_MostrarPedido);
  46. $MostrarPedido = mysql_query($query_limit_MostrarPedido, $pailinea) or die(mysql_error());
  47. $row_MostrarPedido = mysql_fetch_assoc($MostrarPedido);
  48.  
  49. if (isset($_GET['totalRows_MostrarPedido'])) {
  50.   $totalRows_MostrarPedido = $_GET['totalRows_MostrarPedido'];
  51. } else {
  52.   $all_MostrarPedido = mysql_query($query_MostrarPedido);
  53.   $totalRows_MostrarPedido = mysql_num_rows($all_MostrarPedido);
  54. }
  55. $totalPages_MostrarPedido = ceil($totalRows_MostrarPedido/$maxRows_MostrarPedido)-1;
  56.  
  57. mysql_select_db($database_pailinea, $pailinea);
  58. $query_ObtenerIPS = "SELECT ips.cod_ips, ips.nombre, pedidos.cod_ips FROM ips, pedidos WHERE ips.cod_ips = pedidos.cod_ips";
  59. $ObtenerIPS = mysql_query($query_ObtenerIPS, $pailinea) or die(mysql_error());
  60. $row_ObtenerIPS = mysql_fetch_assoc($ObtenerIPS);
  61. $totalRows_ObtenerIPS = mysql_num_rows($ObtenerIPS);
  62.  
  63. $colname_Recordset1 = "-1";
  64. if (isset($_GET['cod_ips'])) {
  65.   $colname_Recordset1 = $_GET['cod_ips'];
  66. }
  67. mysql_select_db($database_pailinea, $pailinea);
  68. $query_Recordset1 = sprintf("SELECT cod_ips, nombre FROM ips WHERE cod_ips = %s", GetSQLValueString($colname_Recordset1, "int"));
  69. $Recordset1 = mysql_query($query_Recordset1, $pailinea) or die(mysql_error());
  70. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  71. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  72. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  73. <html xmlns="http://www.w3.org/1999/xhtml">
  74. <head>
  75. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  76. <title>Documento sin t&iacute;tulo</title>
  77. <script type="text/javascript" src="ExportarExcel/jquery-1.3.2.min.js"></script>
  78. <script language="javascript">
  79. $(document).ready(function() {
  80.     $(".botonExcel").click(function(event) {
  81.         $("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
  82.         $("#FormularioExportacion").submit();
  83. });
  84. });
  85. </script>
  86. <link href="estilo/styles.css" rel="stylesheet" type="text/css" />
  87. <style type="text/css">
  88. <!--
  89. .Estilo1 {color: #000000}
  90. .Estilo2 {color: #FF0000}
  91. .botonExcel {cursor:pointer;}
  92. -->
  93. </style>
  94. </head>
  95.  
  96. <body>
  97. <p>&nbsp;</p>
  98.  
  99.  
  100. <form id="form1" name="form1" method="post" action="">
  101.   <?php echo $row_Recordset1['nombre']; ?>
  102.   <table width="792" border="0" align="center" id="Exportar_a_Excel">
  103.     <tr>
  104.       <td width="143" class="text3"><div align="center"><span class="Estilo1">Fecha de Solicitud</span></div></td>
  105.       <td width="123" class="text3"><div align="center"><span class="Estilo1">Suministro</span></div></td>
  106.       <td width="135" class="text3"><div align="center"><span class="Estilo1">Presentación</span></div></td>
  107.       <td width="153" class="text3"><div align="center"><span class="Estilo1">Casa Productora</span></div></td>
  108.       <td width="116" class="text3"><div align="center"><span class="Estilo1">Cantidad</span></div></td>
  109.       <td width="96" class="text3"><div align="center"><span class="Estilo1">Despachada</span></div></td>
  110.     </tr>
  111.     <?php do { ?>
  112.       <tr class="text3">
  113.         <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['fecha_solicitud']; ?></div></td>
  114.         <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['suministro']; ?></div></td>
  115.         <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['presentacion']; ?></div></td>
  116.         <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['casa_productora']; ?></div></td>
  117.         <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['cantidad']; ?></div></td>
  118.         <td class="Estilo2"><label>
  119.             <div align="center">
  120.               <input name="despachada" type="text" class="Estilo1" id="despachada" value="<?php echo $row_MostrarPedido['entregada']; ?>" />
  121.             </div>
  122.           </label></td>
  123.       </tr>
  124.       <?php } while ($row_MostrarPedido = mysql_fetch_assoc($MostrarPedido)); ?>
  125.       </table>
  126.   <label>
  127.   <input type="submit" name="registrar" id="registrar" value="Enviar" />
  128.   </label>
  129.   <input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_MostrarPedido['cod_ips']; ?>" />
  130.   <input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_Recordset1['cod_ips']; ?>" />
  131. </form>
  132. <p>&nbsp;</p>
  133. <p>&nbsp;</p>
  134. </body>
  135. </html>
  136. <?php
  137. mysql_free_result($MostrarPedido);
  138.  
  139. mysql_free_result($ObtenerIPS);
  140.  
  141. mysql_free_result($Recordset1);
  142. ?>

Muchas gracias por la ayuda. Si eso no es lo que me pedias, por favor disculpame.
  #18 (permalink)  
Antiguo 12/01/2011, 09:27
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

no, no pedía eso pero no te preocupes. Deja entonces las estructuras de las otras dos tablas para recrear todo el sistema.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #19 (permalink)  
Antiguo 12/01/2011, 10:34
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Hola Maestro, gracias

Estas son las tablas necesarias, las cuales utilizo unicamente:

CREATE TABLE IF NOT EXISTS `ips` (
`cod_ips` int(12) NOT NULL,
`nit` varchar(15) CHARACTER SET latin1 DEFAULT NULL,
`nombre` varchar(30) CHARACTER SET latin1 NOT NULL,
`ciudad` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
`telefono` varchar(15) CHARACTER SET latin1 DEFAULT NULL,
`direccion` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
`gerente` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
`tipo_prestacion` varchar(10) CHARACTER SET latin1 DEFAULT NULL,
`email` varchar(30) CHARACTER SET latin1 DEFAULT NULL,
`zona` varchar(10) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`cod_ips`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci ROW_FORMAT=COMPACT;


CREATE TABLE IF NOT EXISTS `pedidos` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`cod_ips` int(12) NOT NULL,
`fecha_solicitud` varchar(12) COLLATE latin1_spanish_ci NOT NULL,
`suministro` varchar(30) COLLATE latin1_spanish_ci NOT NULL,
`presentacion` varchar(30) COLLATE latin1_spanish_ci DEFAULT '',
`casa_productora` varchar(30) COLLATE latin1_spanish_ci DEFAULT '',
`cantidad` varchar(5) COLLATE latin1_spanish_ci NOT NULL,
`entregada` varchar(6) COLLATE latin1_spanish_ci DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=10 ;

- mysql_free_result($MostrarPedido);este muestra información o la consulta de la tabla pedidos
- mysql_free_result($ObtenerIPS);este compara por cod_ips las dos tabla, pedidos e ips
- mysql_free_result($Recordset1); este solamente muestra el codigo y el nombre en la tabla ips
  #20 (permalink)  
Antiguo 12/01/2011, 20:14
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

Ok. Dame hasta mañana para hacer esto ya que hoy llegué tarde a casa.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #21 (permalink)  
Antiguo 12/01/2011, 20:25
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Tranquilo, Maestro.

Muy agradecido estoy contigo.

Gracias.
  #22 (permalink)  
Antiguo 14/01/2011, 09:25
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

Ahora creo entender. Por lo que veo no necesitas múltiples 'inserts', lo que necesitas son múltiples 'update' ya que lo que quieres es actualizar la fecha de entrega, ¿no?
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #23 (permalink)  
Antiguo 14/01/2011, 09:31
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Si, eso es una parte y tambien hacer updates en el campo entregada ya que ese campo viene vacio y ellos lo llenan cuando entregan.

Gracias.
  #24 (permalink)  
Antiguo 14/01/2011, 10:04
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

para eso se puede usar el update que usa DW y después modificarlo. Lo primero es hacer incluir un campo oculto con el valor del id del pedido y lo pones dentro del loop. Yo lo llamé "id":



Uploaded with ImageShack.us

Después le agregas llaves ([]) a los nombres de ese campo y al campo de "despachada". Esto le dice a php que es un array:



Uploaded with ImageShack.us



Uploaded with ImageShack.us

Vas a: Server Behaviors y le das al símbolo de más (+) y escoges: Update Record.



Uploaded with ImageShack.us

Iguala el 'id' al campo 'id[] ' y entregada al campo 'despachada[]':



Uploaded with ImageShack.us

Dw te dará este código:

Código PHP:
Ver original
  1. $editFormAction = $_SERVER['PHP_SELF'];
  2. if (isset($_SERVER['QUERY_STRING'])) {
  3.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  4. }
  5.  
  6. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  7.   $updateSQL = sprintf("UPDATE pedidos SET entregada=%s WHERE id=%s",
  8.                        GetSQLValueString($_POST['despachada'], "text"),
  9.                        GetSQLValueString($_POST['id'], "int"));
  10.  
  11.   mysql_select_db($TU_DATABASE, $TU_CONEXION);
  12.   $Result1 = mysql_query($updateSQL, $TU_CONEXION) or die(mysql_error());
  13. }


Usas el campo post del campo id para hacer el foreach (loop). el mí o quedó así:

Código PHP:
Ver original
  1. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  2.  
  3.   foreach($_POST['id'] as $key => $val){
  4.   $updateSQL = sprintf("UPDATE pedidos SET entregada=%s WHERE id=$val",
  5.                        GetSQLValueString($_POST['despachada'][$key], "text"));
  6.  
  7.   mysql_select_db($TU_DATABASE, $TU_CONEXION);
  8.   $Result1 = mysql_query($updateSQL, $TU_CONEXION) or die(mysql_error());
  9.  
  10.   }
  11. }


Y este es el formulario:

Código HTML:
Ver original
  1. <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
  2.  <?php echo $row_Recordset1['nombre']; ?>
  3.  <table width="792" border="0" align="center" id="Exportar_a_Excel">
  4.   <tr>
  5.    <td width="143" class="text3"><div align="center"><span class="Estilo1">Fecha de Solicitud</span></div></td>
  6.    <td width="123" class="text3"><div align="center"><span class="Estilo1">Suministro</span></div></td>
  7.    <td width="135" class="text3"><div align="center"><span class="Estilo1">Presentación</span></div></td>
  8.    <td width="153" class="text3"><div align="center"><span class="Estilo1">Casa Productora</span></div></td>
  9.    <td width="116" class="text3"><div align="center"><span class="Estilo1">Cantidad</span></div></td>
  10.    <td width="96" class="text3"><div align="center"><span class="Estilo1">Despachada</span></div></td>
  11.   </tr>
  12.   <?php do { ?>
  13.    <tr class="text3">
  14.     <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['fecha_solicitud']; ?></div></td>
  15.     <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['suministro']; ?></div></td>
  16.     <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['presentacion']; ?></div></td>
  17.     <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['casa_productora']; ?></div></td>
  18.     <td class="Estilo2"><div align="center"><?php echo $row_MostrarPedido['cantidad']; ?></div></td>
  19.     <td class="Estilo2"><label>
  20.       <div align="center">
  21.         <input name="despachada[]" type="text" class="Estilo1" id="despachada[]" value="<?php echo $row_MostrarPedido['entregada']; ?>" />
  22.         <input name="id[]" type="hidden" id="id[]" value="<?php echo $row_MostrarPedido['id']; ?>" />
  23.       </div>
  24.      </label></td>
  25.    </tr>
  26.    <?php } while ($row_MostrarPedido = mysql_fetch_assoc($MostrarPedido)); ?>
  27.   </table>
  28.  <label>
  29.  <input type="submit" name="registrar" id="registrar" value="Enviar" />
  30.  </label>
  31.  <input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_MostrarPedido['cod_ips']; ?>" />
  32.  <input name="cod_ips" type="hidden" id="cod_ips" value="<?php echo $row_Recordset1['cod_ips']; ?>" />
  33.  <input type="hidden" name="MM_update" value="form1" />
  34. </form>

como ves he remplazado el valor del id en el sprintf por el valor del array en el foreach y le he agregado [$key] al calor de 'despachada' para que que concuerde con el id que se está actualizando.

Me dices si tienes problemas.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...

Última edición por juaniquillo; 14/01/2011 a las 10:11
  #25 (permalink)  
Antiguo 14/01/2011, 10:10
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Muchas Gracias, lo probare, ya te cuento.
  #26 (permalink)  
Antiguo 14/01/2011, 10:49
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Muchas, pero muchas gracias, no sabe la alegria que tengo por esa colaboración..jajajajaja.
El corazón late a mil.

Una pregunta, que pena hay: puedo implementarlo con un insert de la misma manera. O cambia mucho. Voy a probar de todos modos,cualquier duda te puedo preguntar?.

Le agradesco por sus respuesta oportunas y sabias, Maestro.
No sabe cuanto, de verdad.
  #27 (permalink)  
Antiguo 14/01/2011, 12:53
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

que bueno que te haya servido. el insert se parece más a los ejemplos que te dije anteriormente. inténtalo y si tienes algún problema me dices. saludos.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...
  #28 (permalink)  
Antiguo 14/01/2011, 19:36
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Maestro, revisando las soluciones que me envio sobre los insert, me fije más en el segundo post, y modificando con el update no he podido encontrar la solución al insert multiple que necesito realizar a la tabla pedidos, este es el codigo:

Código PHP:
Ver original
  1. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  2.  
  3. foreach($_POST["cod_ips"] as $key => $value){
  4.  
  5.   $insertSQL = sprintf("INSERT INTO pedidos (cod_ips, fecha_solicitud, suministro, presentacion, casa_productora, cantidad) VALUES (%s, %s, %s, %s, %s, %s)",
  6.                        GetSQLValueString($_POST['inst'][$key], "int"),
  7.                        GetSQLValueString($_POST['fecha_solicitud'][$key], "text"),
  8.                        GetSQLValueString($_POST['suministro_ultimo'][$key], "text"),
  9.                        GetSQLValueString($_POST['presentacion_ultimo'][$key], "text"),
  10.                        GetSQLValueString($_POST['casa_ultimo'][$key], "text"),
  11.                        GetSQLValueString($_POST['cantidad_ultimo'][$key], "text"));
  12.  
  13.   mysql_select_db($TU_DATABASE, $TU_CONEXION);
  14.   $Result1 = mysql_query($insertSQL, $TU_DATABASE) or die(mysql_error());
  15.  }
  16. }
  17. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <title>nada</title>
  22. <script>
  23. function agregaFila( id ) {
  24. var tabla = document.getElementById( id );
  25. var tbody = document.getElementById( tabla.id ).tBodies[0];
  26. var row = tbody.rows[0] .cloneNode( true );
  27. var id = 1;
  28. while( document.getElementById( tabla.id+'_fila_'+id ) ) {
  29. id++;
  30.  
  31. }
  32. if (id<=21){
  33. row.id = tabla.id+'_fila_'+id;
  34. row.style.display = '';
  35. tbody.appendChild( row );
  36. }
  37. }
  38.  
  39. function borraFila( fila ) {
  40. var id = fila.id;
  41. if( fila.parentNode.rows.length <= 2 ) return;
  42. document.getElementById( id ).parentNode.removeChild( document.getElementById(id) );
  43. }
  44.  
  45. </script>
  46.  
  47. <style type="text/css">
  48. <!--
  49. .Estilo1 {  font-size: 80%;
  50.     color: #006699;
  51.     font-weight: bold;
  52. }
  53. .Estilo2 {color: #000000}
  54. .Estilo6 {color: #0066FF}
  55. -->
  56. </style>
  57. </head>
  58.  
  59. <body class="twoColFixLtHdr">
  60. <p>&nbsp;</p>
  61.         <p>&nbsp;</p>
  62. <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
  63.           <table width="223" border="0" align="center">
  64.             <tr>
  65.               <td width="152"><fieldset>
  66.                 <legend class="Estilo1 Estilo2">Fecha</legend>
  67.               <label>
  68.               <input name="fecha_solicitud[]" type="text" id="fecha_solicitud[]" size="12" />
  69.               </label>
  70.               </fieldset>              </td>
  71.               <td width="32">&nbsp;</td>
  72.               <td width="8">&nbsp;</td>
  73.               <td width="13">&nbsp;</td>
  74.             </tr>
  75.           </table>
  76.           <table width="612" border="0">
  77.             <tr>
  78.               <td width="212"><fieldset>
  79.                 <legend class="Estilo1 Estilo2">Institución</legend>
  80.                 <label>
  81.                 <input type="text" name="inst[]" id="inst[]" />
  82.                 </label>
  83.               </fieldset></td>
  84.               <td width="15">&nbsp;</td>
  85.             </tr>
  86.           </table>
  87.           <p>&nbsp;</p>
  88.           <table id="tabla_1" align="center">
  89.             <thead>
  90.               <tr valign="baseline">
  91.                 <td align="center" class="Estilo1 Estilo2">Biologico</td>
  92.                 <td align="center" class="Estilo1 Estilo2">Presentación</td>
  93.                 <td align="center" class="Estilo1 Estilo2">Casa Productora</td>
  94.                 <td align="center" class="Estilo1 Estilo2">Cantidad</td>
  95.                 <td></td>
  96.               </tr>
  97.             </thead>
  98.             <tbody>
  99.               <tr id="clonable" style="display:none">
  100.                 <td><label>
  101.                 <select name="suministro_ultimo[]" id="suministro_ultimo[]">
  102.                   <option>Seleccionar</option>
  103.                   <option value="1">1</option>
  104.                   <option value="2">2</option>
  105.                   <option value="3">3</option>
  106.                   <option value="4">4</option>
  107.                   <option value="5">5</option>
  108.                   <option value="6">6</option>
  109.                   <option value="7">7</option>
  110.                   <option value="8">8</option>
  111.                   <option value="9">9</option>
  112.                   <option value="10">10</option>
  113.                   <option value="11">11</option>
  114.                   <option value="12">12</option>
  115.                   <option value="13">13</option>
  116.                   <option value="14">14</option>
  117.                 </select>
  118.                 </label></td>
  119.                 <td><input name="presentacion_ultimo[]" type="text" id="presentacion_ultimo[]" size="20" /></td>
  120.                 <td><input name="casa_ultimo[]" type="text" id="casa_ultimo[]" size="15" /></td>
  121.                 <td><input name="cantidad_ultimo[]" type="text" id="cantidad_ultimo[]" value="" size="10" /></td>
  122.                 <td><a href="#" class="Estilo6" onclick="borraFila(this.parentNode.parentNode)">Eliminar</a></td>
  123.               </tr>
  124.             </tbody>
  125.             <tr valign="baseline">
  126.               <td nowrap="nowrap" align="center"><a href="javascript:agregaFila( 'tabla_1' );" class="Estilo6">Añadir</a></td>
  127.               <td colspan="4" align="center"><input type="submit" value="Insertar registro" /></td>
  128.             </tr>
  129.           </table>
  130.   <p>&nbsp;</p>
  131.   <input type="hidden" name="MM_insert" value="form1" />
  132. </form>
  133.  </body>
  134. </html>
  #29 (permalink)  
Antiguo 14/01/2011, 19:37
 
Fecha de Ingreso: marzo-2009
Mensajes: 132
Antigüedad: 15 años
Puntos: 8
Respuesta: Insertar multiples Registros

Muchas gracias por todo, cualquier sugerencia es valida.

Gracias.
  #30 (permalink)  
Antiguo 15/01/2011, 13:11
Avatar de juaniquillo
Colaborador
 
Fecha de Ingreso: noviembre-2005
Ubicación: San Juan, Puerto Rico
Mensajes: 5.745
Antigüedad: 18 años, 4 meses
Puntos: 281
Respuesta: Insertar multiples Registros

Estás usando el campo 'cod_ips' para el loop, pero no tienes ningún campo que se llame así en el formulario. Inclúyelo en el formulario o usa uno de los otros, pero tiene que ser uno que siempre tenga un valor, osea que no se envíe vacío.
__________________
Por fin.. tengo algo parecido a un blog
Y por lo visto ya estoy escribiendo...

Etiquetas: editores-web, multiples, registros
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 20:51.