Ver Mensaje Individual
  #14 (permalink)  
Antiguo 10/07/2008, 07:49
Avatar de hoberwilly
hoberwilly
 
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Pregunta Respuesta: grabar en una base de datos

Disculpen por las molestias que estoy causando, pero...

Hice unas modificaciones, pero nada...en esta vez me sale el siguiente mensaje:
Warning: Invalid argument supplied for foreach() in C:AppServ/www/ventas/extraer.php on line 52.... (es la linea del foreach)
<?php
session_start();
?>
<?
include("conec.php");
conectarse();
$id=$_POST['orden'];
$qry=mysql_query("select * from factura where id='$id'") or die("Error en consulta:" .mysql_error() );
if($query=mysql_fetch_array($qry));
$_SESSION["carro"]=unserialize($query['compra']);
if(isset($_SESSION['carro']))
$carro=$_SESSION['carro'];
echo "extraccion oka";
?>

<html>
<head>
<title>PRODUCTOS AGREGADOS AL CARRITO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<h1 align="left">ORDEN DE PEDIDO</h1>
<HR NOSHADE>
<table>
<tr>
<td>Apellidos y Nombres:</td><td><?php echo $query['destinatario'] ?></td>
<tr>
<td>Direcci&oacute;n:</td><td><?php echo $query['direccion'] ?></td>
<tr>
<td>Referencia:</td><td><?php echo $query['referencia'] ?></td>
<tr>
<td>Tel&eacute;fono 1:</td><td><?php echo $query['tel1'] ?></td>
</tr>
</table>
<p>
<table>
<tr bgcolor="#3399CC" align="center"class="tit">
<td width="50%">Producto</td>
<td width="15%">Precio(S/.)</td>
<td width="10%">Cantidad (pares)</td>
<td width="15%">Subtotal(S/.)</td>
</tr>
<?php
$color=array("#ffffff","#F0F0F0");
$contador=0;
$suma=0;
foreach($carro as $k => $v){
$subto=$v['cantidad']*$v['precio'];
$suma=$suma+$subto;
$contador++;
?>
<tr bgcolor="<?php echo $color[$contador%2]; ?>" class='prod'>
<td><?php echo $v['producto'] ?></td>
<td align="right"><?php echo $v['precio'] ?></td>
<td align="center" width="1%"><?php echo $v['cantidad'] ?></td>
<td width="11%"><? echo "".number_format($subto, 2, '.', ','); ?></td>
</tr>
<?php }?>
</table>
<p>
<table width="720" border="1">
<tr>
<td align="right">Total (S/.): </td>
<td align="right"><font color="red"><?php echo number_format($suma,2); ?></font></td>
<td></td>
<td></td>
</tr>
<tr>
<td align="right">N&uacute;mero de Items:</td>
<td align="right"><?php echo count($carro); ?></td>
<td width="8%"></td>
<td></td>
</tr>
</table>
</p>
</body>
</html>


ojo...se visualizan los datos de la cabecera(como son nombre del destinatario, direccion, referencia, telefono, etc) pero lo que no trato de visualizar son los datos del carrito de compra que selecciono el cliente (nombre del producto, precio, subtotal, etc)

agradesco la ayuda brindada, y esperando una respuesta positiva...gracias