scripterdx Posted October 21, 2009 Share Posted October 21, 2009 i´ve wrote this and works when i add an item to, my cart, but when i want to add othrer item just replaces the last one. please help!! <!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>my site</title> <link href="general.css" rel="stylesheet" type="text/css"> <link href="productos.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="funciones.js"></script> </head> </head> <body> <div id="contenido"> <?php include('config.php'); $id=$_GET['i']; $sql= "SELECT * FROM products WHERE id='$id'"; $consulta = mysql_query($sql); $row = mysql_fetch_assoc($consulta); $s=$row['sexo']; $c=$row['categoria']; $f=$row['fotos']; $o=$_GET['o']; $p=$_GET['p']; ?> <h1>CARRO DE COMPRAS</h1> <table> <tr> <td width="110">Foto</td> <td width="110">Marca</td> <td width="110">Producto</td> <td width="110">Precio</td> </tr> <tr> <td><img src='thumbs/productos/<?php echo $row['id'];?>_b.jpg'/></td> <td class="td"><?php echo $row['marca']; ?></td> <td class="td"><?php echo $row['nombre_producto']; ?></td> <td class="td"><?php echo $row['precio']; ?></td> </tr> </table> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/ Share on other sites More sharing options...
waynew Posted October 21, 2009 Share Posted October 21, 2009 Where is the code that handles insertion into the cart? Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941235 Share on other sites More sharing options...
scripterdx Posted October 21, 2009 Author Share Posted October 21, 2009 <a href="#" onClick="openNewWindow('carro.php?i=<?php echo $row['id'],?>','width=440,height=460,scrollbars=no')">Agregar al <span>Carro de Compras</span></a></p> Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941238 Share on other sites More sharing options...
scripterdx Posted October 21, 2009 Author Share Posted October 21, 2009 $id=$_GET['i']; $sql= "SELECT * FROM products WHERE id='$id'"; $consulta = mysql_query($sql); $row = mysql_fetch_assoc($consulta); $s=$row['sexo']; $c=$row['categoria']; $f=$row['fotos']; $o=$_GET['o']; $p=$_GET['p']; ?> Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941240 Share on other sites More sharing options...
waynew Posted October 21, 2009 Share Posted October 21, 2009 Your problem is $row = mysql_fetch_assoc($consulta); You're not looping through the results, meaning your script is always going to show only one row. You should really be doing something like so: while($r = mysql_fetch_assoc($row)){ echo $r['column_name']; } Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941243 Share on other sites More sharing options...
scripterdx Posted October 21, 2009 Author Share Posted October 21, 2009 thanks for that i´ll try it Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941250 Share on other sites More sharing options...
scripterdx Posted October 21, 2009 Author Share Posted October 21, 2009 no luck, any more ideas? Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-941343 Share on other sites More sharing options...
scripterdx Posted October 22, 2009 Author Share Posted October 22, 2009 i´m a bit desperated, ican´t figure it out. i know it seams basic knowlege but any thing that i try worls Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-942119 Share on other sites More sharing options...
scripterdx Posted October 22, 2009 Author Share Posted October 22, 2009 ok i quit i give up this is useless Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-942157 Share on other sites More sharing options...
cags Posted October 22, 2009 Share Posted October 22, 2009 a.) what does your code look like now. b.) you will run in to a proverbial 'shit load' of problems when programming, if your not prepared for that, best to give up now. Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-942163 Share on other sites More sharing options...
scripterdx Posted October 22, 2009 Author Share Posted October 22, 2009 i dosen´t mather any more my boss told that he wnats a sort of wishlist integrated with facebook Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-942253 Share on other sites More sharing options...
scripterdx Posted October 23, 2009 Author Share Posted October 23, 2009 fuck you all´go to hell Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-943054 Share on other sites More sharing options...
cags Posted October 23, 2009 Share Posted October 23, 2009 Nice. Link to comment https://forums.phpfreaks.com/topic/178486-solved-shoping-cart-issues/#findComment-943058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.