Foros del Web » Programando para Internet » PHP »

varios parametros

Estas en el tema de varios parametros en el foro de PHP en Foros del Web. hola chicos, como dice el titulo, necesitaria mandar varios parametros desde una pagina a otra, que va con un enlance, he tratado haciendo miles de ...
  #1 (permalink)  
Antiguo 30/12/2014, 17:23
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
varios parametros

hola chicos, como dice el titulo, necesitaria mandar varios parametros desde una pagina a otra, que va con un enlance, he tratado haciendo miles de cosas ero sin resultado, os pongo el codigo
Código PHP:
Ver original
  1. <td><img src="documentos/productos/<?php echo $row_DatosProducto['strImagen']; ?>" width="450" height="450" /></td>
  2.                     <td valign="top"><p><?php echo $row_DatosProducto['strNombre']; ?></p>
  3.                     <p><?php echo $row_DatosProducto['dblPrecio']; ?></p>
  4.                     <?php if ((isset($_SESSION['MM_IdUsuario']))  && ($_SESSION['MM_IdUsuario']!=""))
  5.                     {?>
  6.                     <p><a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>">Comprar Producto</a></p>
  7.                     <?php }
  8.                     else
  9.                     {?>
  10.                     Necesitas <a href="alta_usuario.php">darte de alta</a> para comprar. Es gratuito.
  11. <?php }?></td>

como ves en esta parte va con un enlace y un recordID <a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?> , pero me gustaria que ademas del producto mandase el nombre, pero no lo consigo, a lo mas que llegue es que me mande el numero de compra, en esta otra pagina lo recoge
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.   $insertSQL = sprintf("INSERT INTO tblcarrito (idUsuario, idProducto, strNombre ,intCantidad) VALUES (%s, %s,  %s, %s)",
  7.                        GetSQLValueString($_SESSION['MM_IdUsuario'], "int"),
  8.                        GetSQLValueString($_GET['strNombre'], "text"),
  9.                        GetSQLValueString($_GET['recordID'], "text"),1);
  10.  
  11.   mysql_select_db($database_conexionzapatos, $conexionzapatos);
  12.   $Result1 = mysql_query($insertSQL, $conexionzapatos) or die(mysql_error());
  13.  
  14.   $insertGoTo = "carrito_lista.php";
  15.   if (isset($_SERVER['QUERY_STRING'])) {
  16.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  17.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  18.   }
  19.   header(sprintf("Location: %s", $insertGoTo));
pero al carro no me llega el nombre, como podria hacerlo, gracias, y disculpas por ser tan pesado,
  #2 (permalink)  
Antiguo 30/12/2014, 19:07
Avatar de manuparquegiralda  
Fecha de Ingreso: junio-2012
Ubicación: Barcelona
Mensajes: 241
Antigüedad: 11 años, 10 meses
Puntos: 39
Respuesta: varios parametros

<a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>&nombre=EL NOMBRE QUE SEA

Código PHP:
Ver original
  1. <?php
  2.  
  3. $producto = $_GET['recordID'];
  4. $nombre = $_GET['nombre'];
  5.  
  6. ?>
__________________
Diseño Web - Arisman Web
  #3 (permalink)  
Antiguo 31/12/2014, 01:04
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

asi no me funciona, me dice indefinida index,
Código PHP:
Ver original
  1. <a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>&nombre=<?php echo $row_DatosProducto['strNombre']; ?>">Comprar Producto</a>
Código PHP:
Ver original
  1. <?php $producto = $_GET['recordID'];
  2. $nombre = $_GET['strNombre'];?>
  #4 (permalink)  
Antiguo 31/12/2014, 04:00
Avatar de toledo_nocturno  
Fecha de Ingreso: agosto-2011
Ubicación: Under the northen star
Mensajes: 86
Antigüedad: 12 años, 8 meses
Puntos: 5
Respuesta: varios parametros

Hola Eslomao,

Yo para poder echarte una mano tendría que ver algo más de código de la aplicación; concretamente, del .php que va a recibir los parámetros que le pasas por _GET. Si te está mostrando ese error, es que tienes algo que está filtrando o escuchando algo por ahí.

Un saludo!
__________________
diseño web | Clan Rol
  #5 (permalink)  
Antiguo 31/12/2014, 05:35
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

ok, te paso el codigo de las 3 paginas, uno donde se compra, otra que lo añade de forma oculta y la que lo recibe,
aki se compra
Código PHP:
Ver original
  1. <?php require_once('Connections/conexionzapatos.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. $varProducto_DatosProducto = "0";
  35. if (isset($_GET["recordID"])) {
  36.   $varProducto_DatosProducto = $_GET["recordID"];
  37. }
  38. mysql_select_db($database_conexionzapatos, $conexionzapatos);
  39. $query_DatosProducto = sprintf("SELECT * FROM tblproducto WHERE tblproducto.idProducto = %s", GetSQLValueString($varProducto_DatosProducto, "int"));
  40. $DatosProducto = mysql_query($query_DatosProducto, $conexionzapatos) or die(mysql_error());
  41. $row_DatosProducto = mysql_fetch_assoc($DatosProducto);
  42. $totalRows_DatosProducto = mysql_num_rows($DatosProducto);
  43.  
  44.  
  45.  
  46. ?>
  47. <head>
  48. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  49. <!-- InstanceBeginEditable name="doctitle" -->
  50. <title>Documento sin título</title>
  51. <!-- InstanceEndEditable -->
  52. <!-- InstanceBeginEditable name="head" -->
  53. <!-- InstanceEndEditable -->
  54. <link href="estilo/principal.css" rel="stylesheet" type="text/css" />
  55. </head>
  56.  
  57. <body>
  58.  
  59. <div class="container">
  60.   <div class="header"><div class="headerinterior"><img src="images/logotrans.png" width="283" height="64" alt="Tienda Zapatos" /></div></div>
  61.   <div class="subcontenedor">
  62.               <div class="sidebar1">
  63.                <?php include("includes/catalogo.php"); ?>
  64. <!-- end .sidebar1 --></div>
  65.               <div class="content">
  66.                 <?php echo $row_DatosProducto['strNombre']; ?>
  67.                
  68.                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  69.                   <tr>
  70.                     <td><img src="documentos/productos/<?php echo $row_DatosProducto['strImagen']; ?>" width="450" height="450" /></td>
  71.                     <td valign="top"><p><?php echo $row_DatosProducto['strNombre']; ?></p>
  72.                     <p><?php echo $row_DatosProducto['dblPrecio']; ?></p>
  73.                     <?php if ((isset($_SESSION['MM_IdUsuario']))  && ($_SESSION['MM_IdUsuario']!=""))
  74.                     {?>
  75.                     <p><a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>">Comprar Producto</a></p>
  76.                     <?php }
  77.                     else
  78.                     {?>
  79.                     Necesitas <a href="alta_usuario.php">darte de alta</a> para comprar. Es gratuito.
  80. <?php }?></td>
  81.                   </tr>
  82.                   <tr>
  83.                   </tr>
  84.                 </table>
  85.                 </div>
  86.     <!-- end .subcontenedor -->
  87.     </div>
  88.   <div class="footer">
  89.     <p>Pie de pagina</p>
  90.     <!-- end .footer --></div>
  91.   <!-- end .container --></div>
  92. </body>
  93. </html>
  94. <?php
  95. mysql_free_result($DatosProducto);
  96. ?>

esta recibe los productos y los manda a otra de manera oculta
Código PHP:
Ver original
  1. <?php require_once('Connections/conexionzapatos.php'); ?>
  2.  
  3. <?php
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11. switch ($theType) {
  12.     case "text":
  13.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14.       break;    
  15.     case "long":
  16.     case "int":
  17.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18.       break;
  19.     case "double":
  20.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  21.       break;
  22.     case "date":
  23.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.       break;
  25.     case "defined":
  26.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27.       break;
  28.   }
  29.   return $theValue;
  30. }
  31. }
  32.  
  33. $editFormAction = $_SERVER['PHP_SELF'];
  34. if (isset($_SERVER['QUERY_STRING'])) {
  35.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  36. }
  37.  $insertSQL = sprintf("INSERT INTO tblcarrito (idUsuario, idProducto, strNombre ,intCantidad) VALUES (%s, %s,  %s, %s)",
  38.                        GetSQLValueString($_SESSION['MM_IdUsuario'], "int"),
  39.                        GetSQLValueString($_GET['strNombre'], "text"),
  40.                        GetSQLValueString($_GET['recordID'], "text"),1);
  41.  mysql_select_db($database_conexionzapatos, $conexionzapatos);
  42.   $Result1 = mysql_query($insertSQL, $conexionzapatos) or die(mysql_error());
  43.  $insertGoTo = "carrito_lista.php";
  44.   if (isset($_SERVER['QUERY_STRING'])) {
  45.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  46.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  47.   }
  48.   header(sprintf("Location: %s", $insertGoTo));
  49. ?>
y esta lo saca por pantalla
Código PHP:
Ver original
  1. <?php require_once('Connections/conexionzapatos.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. $varUsuario_DatosCarrito = "0";
  35. if (isset($_SESSION["MM_IdUsuario"])) {
  36.   $varUsuario_DatosCarrito = $_SESSION["MM_IdUsuario"];
  37. }
  38. mysql_select_db($database_conexionzapatos, $conexionzapatos);
  39. $query_DatosCarrito = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0", GetSQLValueString($varUsuario_DatosCarrito, "int"));
  40. $DatosCarrito = mysql_query($query_DatosCarrito, $conexionzapatos) or die(mysql_error());
  41. $row_DatosCarrito = mysql_fetch_assoc($DatosCarrito);
  42. $totalRows_DatosCarrito = mysql_num_rows($DatosCarrito);
  43. ?>
  44. <table width="900" border="0" cellspacing="0" cellpadding="0">
  45.                   <tr>
  46.                     <td width="247">Producto</td>
  47.                     <td>nombre</td>
  48.                     <td>Unidades</td>
  49.                     <td width="265">Precio</td>
  50.                     <td width="84">Acciones</td>
  51.                   </tr>
  52.                   <?php $preciototal = 0;?>
  53.                   <?php do { ?>
  54.   <tr>
  55.     <td><?php echo ObtenerNombreProducto($row_DatosCarrito['idProducto']); ?></td>
  56.     <td width="39"><?php echo $row_DatosCarrito['strNombre']; ?></td>
  57.     <td width="265"><?php echo $row_DatosCarrito['intCantidad']; ?></td>
  58.     <td><?php echo ObtenerPrecioProducto($row_DatosCarrito['idProducto']); ?> Euros</td>
  59.     <td><a href="eliminar_producto.php?recordID=<?php echo $row_DatosCarrito['idProducto']; ?>">Eliminar</a></td>
  60.   </tr>
  61. <?php   $preciototal = $preciototal + ObtenerPrecioProducto($row_DatosCarrito['idProducto']);?>
  62.   <?php } while ($row_DatosCarrito = mysql_fetch_assoc($DatosCarrito)); ?>
  63.         <tr>
  64.     <td>&nbsp;</td>
  65.     <td align="right">&nbsp;</td>
  66.     <td align="right">Subtotal:</td>
  67.     <td><?php echo $preciototal; ?> Euros</td>
  68.     <td>&nbsp;</td>
  69.   </tr>
  70.         <tr>
  71.           <td>&nbsp;</td>
  72.           <td align="right">&nbsp;</td>
  73.           <td align="right">IVA:</td>
  74.           <td><?php echo ObtenerIVA(); ?>%</td>
  75.           <td>&nbsp;</td>
  76.         </tr>
  77.         <tr>
  78.           <td>&nbsp;</td>
  79.           <td align="right">&nbsp;</td>
  80.           <td align="right">Valor del IVA:</td>
  81.           <td><?php
  82.           $multiplicador =  ObtenerIVA()/100;
  83.           $valordelIVA = $preciototal * $multiplicador;
  84.           echo $valordelIVA;?> Euros</td>
  85.           <td>&nbsp;</td>
  86.         </tr>
  87.         <tr>
  88.           <td>&nbsp;</td>
  89.           <td align="right">&nbsp;</td>
  90.           <td align="right">Total con IVA:</td>
  91.           <td><?php
  92.           $multiplicador =  (100 + ObtenerIVA())/100;
  93.           $valorconIVA = $preciototal * $multiplicador;
  94.           echo $valorconIVA;?> Euros</td>
  95.           <td>&nbsp;</td>
  96.         </tr>
  97.  </table>
  98.                 <a href="carrito_forma_pago.php">Seleccionar Forma de Pago</a>
ahi esta todo, gracias
  #6 (permalink)  
Antiguo 31/12/2014, 05:55
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 9 meses
Puntos: 22
Respuesta: varios parametros

Cita:
Iniciado por eslomao Ver Mensaje
asi no me funciona, me dice indefinida index,
Código PHP:
Ver original
  1. <a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>&nombre=<?php echo $row_DatosProducto['strNombre']; ?>">Comprar Producto</a>
Código PHP:
Ver original
  1. <?php $producto = $_GET['recordID'];
  2. $nombre = $_GET['strNombre'];?>
¿En que página y línea te da el error? Prueba a poner un
Código PHP:
Ver original
  1. print_r($row_DatosProducto);

en la página de compra, detrás de
Código PHP:
Ver original
  1. $row_DatosProducto = mysql_fetch_assoc($DatosProducto);

para ver que datos se obtienen.
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla
  #7 (permalink)  
Antiguo 31/12/2014, 07:47
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

hola, gracias pro las respuestas , te explico, con lo que me dijistes ya se lo que se obtiene, por ejemplo en la de compas se obtiene esto Array ( [idProducto] => 42 [strNombre] => sdsdsd [strSEO] => adad [dblPrecio] => 100 [intEstado] => 1 [intCategoria] => 1 [strImagen] => pantalon mujer.jpg )
y en la que debe de mostrar lo comprado, obtiene esto Array ( [intContador] => 49 [idUsuario] => 1 [idProducto] => 38 [intCantidad] => 1 [intTransaccionEfectuada] => 0 [dblPrecio] => [strNombre] => 38 ) , el problema es el en el de mostrar la compra em strNombre me aparece el numero 38 , que digamos es el numero de de compras realizadas hasta el momento (1,2,3, etc..) , y lo que yo quisiera que apareciera no es eso, sino el nombre del artico que se compro, antes no salia ese numero y lo consegui sacar, pero un cliente querria ver que compra, no ese numero, ahi es donde tengo ese problema,
  #8 (permalink)  
Antiguo 31/12/2014, 08:00
Avatar de loncho_rojas
Colaborador
 
Fecha de Ingreso: octubre-2008
Ubicación: En el mejor lugar del mundo
Mensajes: 2.704
Antigüedad: 15 años, 6 meses
Puntos: 175
Respuesta: varios parametros

Que tanto entiendes de PHP?

Si envias parametros entre páginas, pues primero deberías verificar que recibes esos parametros, y luego realizar una acción, no asignar directamente el parametro a una variable, que lo estarías usando mas adelante.. si llegare vacio o no llegare, pues te generaría el problema y nosostros desde aca no podemos saberlo... puede que no estés enviando nada, ya se porque en tu base de datos no existe un nombre, o tal vez escribiste mal en nombre de la variable a pasar, y cosas asi...

IF(ISSET($_GET['variable'])){
$VARIABLE = $_GET['variable'];
}ELSE{
ECHO "NO SE RECIBEN VARIABLES";
}

por ejemplo.. haz una prueba si de verdad recibes la variable, o sino, verifica que lo escribes bien
__________________
Ayudo con lo que puedo en el foro, y solo en el foro.. NO MENSAJES PRIVADOS.. NO EMAILS NI SKYPE u OTROS.

Antes de hacer un TOPICO piensa si puedes hallarlo en Google o en el Buscador del Foro...

Última edición por loncho_rojas; 31/12/2014 a las 08:07
  #9 (permalink)  
Antiguo 31/12/2014, 08:14
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

el dato en si me aparece, pero en vez del nombre de ese producto me aparece un numero, que corresponderia a la compra, los otrtos datos se me olvido decirlo que los obtengo de unas funciones, voy a jugar con ellasa ver si hay suerte, gracias
  #10 (permalink)  
Antiguo 31/12/2014, 08:31
Avatar de loncho_rojas
Colaborador
 
Fecha de Ingreso: octubre-2008
Ubicación: En el mejor lugar del mundo
Mensajes: 2.704
Antigüedad: 15 años, 6 meses
Puntos: 175
Respuesta: varios parametros

Algo no cuadra a la hora de asignarles los valores a las variables.. si sabes que te trae X dato en vez de Z, pues es cuestion de mirar al momento de asignarlo..
__________________
Ayudo con lo que puedo en el foro, y solo en el foro.. NO MENSAJES PRIVADOS.. NO EMAILS NI SKYPE u OTROS.

Antes de hacer un TOPICO piensa si puedes hallarlo en Google o en el Buscador del Foro...
  #11 (permalink)  
Antiguo 31/12/2014, 08:55
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

ya eso es lo malo, el dato lo manda, pero en ver de mandarlo como nombre, me lo esta mandando con el id de la base, y eso queda feo, aki pongo las funciones, a ver si hay mejor suerte
Código PHP:
Ver original
  1. function ObtenerNombreUsuario($identificador)
  2. {
  3.  
  4.     global $database_conexionzapatos, $conexionzapatos;
  5.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  6.     $query_ConsultaFuncion = sprintf("SELECT tblusuario.strNombre FROM tblusuario WHERE tblusuario.idUsuario = %d", $identificador);
  7.     $ConsultaFuncion = mysql_query($query_ConsultaFuncion, $conexionzapatos) or die(mysql_error());
  8.     $row_ConsultaFuncion = mysql_fetch_assoc($ConsultaFuncion);
  9.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  10.    
  11.     return $row_ConsultaFuncion['strNombre'];
  12.     mysql_free_result($ConsultaFuncion);
  13. }
  14.  
  15. //***************************************************
  16. //***************************************************
  17. //***************************************************
  18.  
  19. [B]function Nombre($identificador)[/B]
  20. {
  21.  
  22.     [B]global $database_conexionzapatos, $conexionzapatos;[/B]
  23.     [B]mysql_select_db($database_conexionzapatos, $conexionzapatos);[/B]
  24.     $query_ConsultaFuncion = sprintf("SELECT tblproducto.strNombre FROM tblproducto ORDER BY tblproducto.strNombre ASC", $identificador);
  25.     $ConsultaFuncion = mysql_query($query_ConsultaFuncion, $conexionzapatos) or die(mysql_error());
  26.     $row_ConsultaFuncion = mysql_fetch_assoc($ConsultaFuncion);
  27.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  28.    
  29.     mysql_free_result($ConsultaFuncion);
  30.     [B]return $row_ConsultaFuncion['strNombre']; [/B]
  31.    
  32.    
  33. }
  34.  
  35. (aqui intento obtener el nombre del producto, pero....)
  36.  
  37. //***************************************************
  38. //***************************************************
  39. //***************************************************
  40.  
  41.  
  42. function ObtenerNombreProducto($identificador)
  43. {
  44.  
  45.     global $database_conexionzapatos, $conexionzapatos;
  46.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  47.     $query_ConsultaFuncion = sprintf("SELECT tblproducto.strNombre FROM tblproducto WHERE idProducto = %d", $identificador);
  48.     $ConsultaFuncion = mysql_query($query_ConsultaFuncion, $conexionzapatos) or die(mysql_error());
  49.     $row_ConsultaFuncion = mysql_fetch_assoc($ConsultaFuncion);
  50.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  51.    
  52.     mysql_free_result($ConsultaFuncion);
  53.     return $row_ConsultaFuncion['strNombre'];
  54.    
  55. }
  56.  
  57. //***************************************************
  58. //***************************************************
  59. //***************************************************
  60.  
  61. function ObtenerPrecioProducto($identificador)
  62. {
  63.  
  64.     global $database_conexionzapatos, $conexionzapatos;
  65.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  66.     $query_ConsultaFuncion = sprintf("SELECT tblproducto.dblPrecio FROM tblproducto WHERE idProducto = %d", $identificador);
  67.     $ConsultaFuncion = mysql_query($query_ConsultaFuncion, $conexionzapatos) or die(mysql_error());
  68.     $row_ConsultaFuncion = mysql_fetch_assoc($ConsultaFuncion);
  69.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  70.    
  71.     mysql_free_result($ConsultaFuncion);
  72.     return $row_ConsultaFuncion['dblPrecio'];
  73.    
  74. }
  75.  
  76. //***************************************************
  77. //***************************************************
  78. //***************************************************
  79.  
  80. function ObtenerIVA()
  81. {
  82.  
  83.     global $database_conexionzapatos, $conexionzapatos;
  84.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  85.     $query_ConsultaFuncion = "SELECT intIVA FROM tblvariables WHERE idContador = 1";
  86.     $ConsultaFuncion = mysql_query($query_ConsultaFuncion, $conexionzapatos) or die(mysql_error());
  87.     $row_ConsultaFuncion = mysql_fetch_assoc($ConsultaFuncion);
  88.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  89.    
  90.     return $row_ConsultaFuncion['intIVA'];
  91.     mysql_free_result($ConsultaFuncion);
  92. }
  93.  
  94. //***************************************************
  95. //***************************************************
  96. //***************************************************
  97.  
  98.  
  99.  
  100. function ConfirmacionPago($tipopago)
  101. {
  102.  
  103.     global $database_conexionzapatos, $conexionzapatos;
  104.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  105.     $insertSQL = sprintf("INSERT INTO tblcompra (idUsuario, fthCompra, intTipoPago, dblTotal) VALUES (%s, NOW(), %s, %s)",
  106.                             GetSQLValueString ($_SESSION['MM_IdUsuario'], "int"),
  107.                             $tipopago,
  108.                             0);
  109.                
  110.     $result1 = mysql_query ($updateSQL, $conexionzapatos) or die(mysql_error());
  111.     $ultimacompra = mysql_insert_id();
  112.     $totalRows_ConsultaFuncion = mysql_num_rows($ConsultaFuncion);
  113.    
  114.     return $row_ConsultaFuncion['intIVA'];
  115.     mysql_free_result($ConsultaFuncion);
  116.     ActualizacionCarrito($ultimacompra);
  117. }
  118.  
  119. //***************************************************
  120. //***************************************************
  121. //***************************************************
  122.  
  123.  
  124. function ActualizacionCarrito($varcompra)
  125. {
  126.  
  127.     global $database_conexionzapatos, $conexionzapatos;
  128.     $updateSQL = sprintf("UPDATE tblcarrito SET intTransaccionEfectuada=%s WHERE idUsuario=%s AND intTransaccionEfectuada = 0",
  129.                    
  130.                               $varcompra,$_SESSION['MM_IdUsuario']);
  131.    
  132.     mysql_select_db($database_conexionzapatos, $conexionzapatos);
  133.     $result1 = mysql_query ($updateSQL, $conexionzapatos) or die(mysql_error());
  134. }
  135.    
  136. ?>
  #12 (permalink)  
Antiguo 31/12/2014, 09:32
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

el problema creo que radica aki <a href="carrito_add.php?recordID=<?php echo $row_DatosProducto['idProducto']; ?>">Comprar Producto</a></p>, seria el poner los dos parametros en el mismo enlace, pero no se como se hace ,
  #13 (permalink)  
Antiguo 31/12/2014, 16:56
 
Fecha de Ingreso: septiembre-2008
Mensajes: 38
Antigüedad: 15 años, 7 meses
Puntos: 2
A partir del segundo parámetro se usa &... Ejemplo....
página.php?idcompra=1&nombre=jorge&apellido=Pér ez
  #14 (permalink)  
Antiguo 31/12/2014, 19:29
 
Fecha de Ingreso: noviembre-2014
Mensajes: 60
Antigüedad: 9 años, 5 meses
Puntos: 0
Respuesta: varios parametros

tampoco va, al hacerle un recordID solo me recoge un parametro, habria que pasar los dos por el mismo enlace y que mande a la base de datos o la otra pagina ademas los dos datos, el idproducto con una funcion me cambia el idproducto y me saca el nombre, pero en el caso del strNombre, a la base de datos o no me llega nada o me llega un numero 0 ,
  #15 (permalink)  
Antiguo 02/01/2015, 06:07
Avatar de angelAparicio  
Fecha de Ingreso: julio-2009
Ubicación: Sevilla
Mensajes: 307
Antigüedad: 14 años, 9 meses
Puntos: 22
Respuesta: varios parametros

Creo que ya se donde está el problema. La línea que debería mostrar el nombre es esta, ¿no?:
Código PHP:
Ver original
  1. <td width="39"><?php echo $row_DatosCarrito['strNombre']; ?></td>

Que obtiene los datos de esta consulta:
SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0

Y la linea donde guardas los datos es esta otra:
Código PHP:
Ver original
  1. $insertSQL = sprintf("INSERT INTO tblcarrito (idUsuario, idProducto, strNombre ,intCantidad) VALUES (%s, %s,  %s, %s)",
  2.                        GetSQLValueString($_SESSION['MM_IdUsuario'], "int"),
  3.                        GetSQLValueString($_GET['strNombre'], "text"),
  4.                        GetSQLValueString($_GET['recordID'], "text"),1);

Si te fijas, estás guardando lo siguiente:
idUsuario => $_SESSION['MM_IdUsuario']
idProducto => $_GET['strNombre']
strNombre => $_GET['recordID'],
intCantidad => 1.

Con lo cual en strNombre guardas el recordId en lugar del nombre y por eso lo muestra mal.

¿Puede ser?
__________________
Mis webs:
- Programador Web Autónomo
- Conciertos en Sevilla

Etiquetas: html, mysql, parametros, select, sql
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 17:15.