06/07/2011, 10:50
|
| | Fecha de Ingreso: mayo-2011 Ubicación: aqp
Mensajes: 52
Antigüedad: 13 años Puntos: 0 | |
solucionar Unknown column 'p.nombreproduc in 'field list' mensaje en la web
( ! ) Notice: Undefined index: observaciones in C:\wamp\www\serv\enviapedido.php on line 5
Call Stack
# Time Memory Function Location
1 0.0018 414984 {main}( ) ..\enviapedido.php:0
-------------------------
quisiera solucionar este problema Unknown column 'p.nombreproduc' in 'field list' Código PHP: <?php require_once('Connections/conexionCP.php'); ?> <?php session_start(); $observaciones = $_POST["observaciones"]; $colname1_rorden = "-1"; if (isset($_SESSION['IdCliente'])) { $colname1_rorden = (get_magic_quotes_gpc()) ? $_SESSION['IdCliente'] : addslashes($_SESSION['IdCliente']); } $colname_rorden = "-1"; if (isset($_SESSION['IdOrden'])) { $colname_rorden = (get_magic_quotes_gpc()) ? $_SESSION['IdOrden'] : addslashes($_SESSION['IdOrden']); } // Recordset para obtener los datos de los productos que formarán parte del pedido mysql_select_db($database_conexionCP, $conexionCP); $query_rorden = sprintf("SELECT b.codorden, b.codproducto, p.nombreproduc, b.cantidad, p.precio_normal, p.precio_oferta FROM carrito as b, clientes as c, productos as p WHERE b.codorden = '%s' and b.codcliente=c.codcliente and b.codcliente='%s' and b.codproducto=p.codproducto", $colname_rorden,$colname1_rorden); $rorden = mysql_query($query_rorden, $conexionCP) or die(mysql_error()); $row_rorden = mysql_fetch_assoc($rorden); $totalRows_rorden = mysql_num_rows($rorden); // Recordset para obtener datos del cliente $colname_rscliente = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_rscliente = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_conexionCP, $conexionCP); $query_rscliente = sprintf("SELECT * FROM clientes WHERE codcliente = '%s'", $colname_rscliente); $rscliente = mysql_query($query_rscliente, $conexionCP) or die(mysql_error()); $row_rscliente = mysql_fetch_assoc($rscliente); $totalRows_rscliente = mysql_num_rows($rscliente); ///generando mensaje para el correo electrónico $mensaje = ' <table width=513 border=0 cellspacing=0 cellpadding=0> <tr> <td width=9></td> <td align=center>Nº de Orden:' . $row_rorden[codorden] . '</td> <td width=9></td> </tr> </table> <table width=513 border=1 cellpadding=0 cellspacing=0 bordercolor=#CCCCCC> <tr> <td width=27 height=20 align=center bgcolor=#F9F9F9><p>Nº</p></td> <td width=206 height=20 align=center bgcolor=#F9F9F9><p>Producto</p></td> <td width=82 height=20 align=center bgcolor=#F9F9F9><p>Cantidad</p></td> <td width=82 height=20 align=center bgcolor=#F9F9F9><p>Precio</p></td> <td width=82 height=20 align=center bgcolor=#F9F9F9><p>Subtotal</p></td> </tr>'; $contador = 0; do { $contador = $contador + 1; if ($row_rorden[precio_oferta] != 0) { $tPrecio = $row_rorden[precio_oferta]; $subtotal = $row_rorden[cantidad] * $row_rorden[precio_oferta]; } else { $tPrecio = $row_rorden[precio_normal]; $subtotal = $row_rorden[cantidad] * $row_rorden[precio_normal]; } $total = $total + $subtotal; $igv = $total * 0.19; $neto = $total + $igv; $mensaje = $mensaje . ' <tr><td height=20 align=center>' . $contador . '</td> <td height=20><p>' . $row_rorden[nombrelibro] . '</td> <td height=20 align=center>' . $row_rorden[cantidad] . '</td> <td width=82 height=20 align=right>' . number_format($tPrecio,2) . '</td> <td width=82 height=20 align=right>' . number_format($subtotal,2) . '</td> </tr>'; } while ($row_rorden = mysql_fetch_assoc($rorden)); $mensaje = $mensaje . ' </table> <table width=513 border=0 cellspacing=0 cellpadding=0> <tr><td width=428 height=20 align=right>Sub Total : </td><td width=85 align=right bgcolor=#F9F9F9>'. number_format($total,2) . '</td></tr> <tr><td width=428 height=20 align=right>IGV : </td><td width=85 align=right bgcolor=#F9F9F9>'. number_format($igv,2) . '</td></tr> <tr><td width=428 height=20 align=right>Neto : </td><td width=85 align=right bgcolor=#F9F9F9>'. number_format($neto,2) . '</td></tr> </table> <table width=513 border=0 cellspacing=0 cellpadding=0> <tr><td width=9 height=30></td><td align=center>Datos del Comprador</td><td width=9></td></tr> </table> <table width="519" border="1" cellpadding="0" cellspacing="0"> <tr><td width="40%" height=30 align="right"><p class="precios">Nombre : </p></td><td width="60%">' . $row_rscliente[nombre] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">Apellido : </p></td><td width="60%">' . $row_rscliente[apellidos] . '</tr> <tr><td width="40%" height=30 align="right"><p class="precios">Razón Social : </p></td><td width="60%">' . $row_rscliente[razonsocial] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">DNI : </p></td><td width="60%">' . $row_rscliente[ndi] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">Dirección : </p></td><td width="60%">' . $row_rscliente[direccion] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">Teléfono : </p></td><td width="60%">' . $row_rscliente[telefono] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">Email : </p></td><td width="60%">' . $row_rscliente[email] . '</td></tr> <tr><td width="40%" height=30 align="right"><p class="precios">Observaciones : </p></td><td width="60%">' . $observaciones . '</td></tr> </table>'; $fecha = date("Y-m-d h:i:s A"); $xCliente = $_SESSION['IdCliente']; $xOrden = $_SESSION['IdOrden']; // Agreando datos a pedido $sql = "insert into pedidos(codorden,codcliente,fechapedido,observaciones,bruto,igv,total) values('$xOrden','$xCliente','$fecha','$observaciones','$total','$igv','$neto')"; $result = mysql_query($sql); // Agreando datos a detalle de pedido $colname1_rorden = "-1"; if (isset($xCliente)) { $colname1_rorden = (get_magic_quotes_gpc()) ? $xCliente : addslashes($xCliente); } $colname_rorden = "-1"; if (isset($xOrden)) { $colname_rorden = (get_magic_quotes_gpc()) ? $xOrden : addslashes($xOrden); } $query_rorden = sprintf("SELECT b.codorden, b.codproducto, p.nombreproduc, b.cantidad, p.precio_normal, p.precio_oferta FROM carrito as b, clientes as c, productos as p WHERE b.codorden = '%s' and b.codcliente=c.codcliente and b.codcliente='%s' and b.codproducto=p.codproducto", $colname_rorden,$colname1_rorden); $rorden = mysql_query($query_rorden, $conexionCP) or die(mysql_error()); $row_rorden = mysql_fetch_assoc($rorden); $totalRows_rorden = mysql_num_rows($rorden); do { $xProducto = $row_rorden[codproducto]; if ($row_rorden[precio_oferta] != 0) { $xPrecio = $row_rorden[precio_oferta]; } else { $xPrecio = $row_rorden[precio_normal]; } $xCantidad = $row_rorden[cantidad]; $sql = "insert into pedidodetalle(codorden,codproducto,precio,cantidad) values('$xOrden','$xProducto','$xPrecio','$xCantidad')"; $result = mysql_query($sql); } while ($row_rorden = mysql_fetch_assoc($rorden)); // Borrando registros del carrito $sql = "delete from carrito where codorden='$xOrden' and codcliente='$xCliente'"; $result = mysql_query($sql); $_SESSION['IdOrden'] = ""; unset($_SESSION['IdOrden']); // datos de correo para el envio de pedido /* $sendTo = "[email protected]"; $subject = "Orden de Pedido N° " . $xOrden; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: " . $row_rscliente[email]; $headers .= "<" . $row_rscliente[email] . ">\r\n"; $headers .= "Reply-To: " . $row_rscliente[email]; $message = $mensaje; mail($sendTo, $subject, $message, $headers); */ header("Location: confirmar_envio.php"); ?> |