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> Quote Link to comment 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? Quote Link to comment 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> Quote Link to comment 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']; ?> Quote Link to comment 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']; } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
scripterdx Posted October 21, 2009 Author Share Posted October 21, 2009 no luck, any more ideas? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
scripterdx Posted October 23, 2009 Author Share Posted October 23, 2009 fuck you all´go to hell Quote Link to comment Share on other sites More sharing options...
cags Posted October 23, 2009 Share Posted October 23, 2009 Nice. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.