Jump to content

pedrolopes10

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pedrolopes10's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, the subject says all, i think the IE can't get the image src.. already tried document.getElementByID("imagemdet").src <script type="text/javascript" language="javascript"> function swapImg(ima){ imagemdet.src=ima current = document.imagemdet.src; } function loadImage(){ var url = document.imagemdet.src; abrirImagem(url); } var current; var old; function mouseOver(ima){ old = document.imagemdet.src; swapImg(ima); } function mouseOut(){ if(old != current) swapImg(old); } function clikes(ima){ old = ima; swapImg(ima); } </script> <? $img = $reg_det['img']; //it's like '123123.jpg ?> <a href="javascript: loadImage();"><img width="250" height="221" name="imagemdet" id="imagemdet" src=\<?=$reg_det['img']?> /></a><br /> <a href="#" onMouseOver="mouseOver('$img');" onMouseOut="mouseOut();"><img width='20' height='20' onclick="clikes('$img');" src=$img></a>
  2. Hi... i'm sorry about the spam but i really need help... thanks
  3. it's a form and in the database i got the product id, name and color (red+yellow+brown) i didn't understand your sugest but something like an id to a color and then in the form to select the color I SELECT from table with the same name(for example)?
  4. oh sorry i forgot $sql_det = "SELECT * FROM produtos WHERE id_produto = '$id_prod'"; $exe_det = mysql_query($sql_det, $base) or die(mysql_error()); ... while ($reg_det = mysql_fetch_array($exe_det, MYSQL_ASSOC)){ $cor = $reg_det['color_produto']; $size = $reg_det['size_produto']; <form action="cart.php?accao=add&id=<?=$id_prod?>" method="post"> <select name="color"> <?php $color_list = explode("+", $color); for ($i=0;$i<count($color_list);$i++) { ?> <option value="<?php echo $color_list[$i]; ?>"><? echo $color_list[$i]; ?></option> <? } ?> </select> it's a form and in the database i got the product id, name and color (red+yellow+brown) i didn't understand your sugest but something like an id to a color and then in the form to select the color I SELECT from table with the same name(for example)?
  5. I'm using MySQL 5.1.30 and PHP 5.2.8 the code i have in shipping cart.php to add the product to the cart: <?php if (isset($_GET['accao'])){ if ($_GET['accao'] == "add"){ if (isset($_GET['id'])){ if (is_numeric($_GET['id'])){ $id_prod = addslashes(htmlentities($_GET['id'])); $cor_car = addslashes($_POST["color"]); $tmnh_car = addslashes($_POST["size"]); $sql_cont = "SELECT COUNT(*) AS n_prod FROM carrinho WHERE id_produto = '$id_prod' AND color_carrinho = '$color_car' AND size_carrinho = '$size_car' AND sessao = '".session_id()."'"; $exe_cont = mysql_query($sql_cont, $base) or die(mysql_error()); $reg_cont = mysql_fetch_array($exe_cont, MYSQL_ASSOC); //por um update para adicionar as quantidades iguais if($reg_cont['n_prod'] == 0){ $sql_prod = "SELECT * FROM produtos WHERE id_produto = '$id_prod'"; $exe_prod = mysql_query($sql_prod, $base) or die(mysql_error()); $num_prod = mysql_num_rows($exe_prod); if($num_prod > 0){ $reg_prod = mysql_fetch_array($exe_prod, MYSQL_ASSOC); $sql_add = "INSERT INTO carrinho (id_produto, nome_produto, preco_produto, qtd_produto, color_carrinho, size_carrinho, sessao) VALUES ('".$reg_prod['id_produto']."', '".$reg_prod['nome_produto']."', '".$reg_prod['preco_produto']."', '".$_POST["qtd"]."', '".$_POST["color"]."', '".$_POST["size"]."', '".session_id()."')"; $exe_add = mysql_query($sql_add, $base) or die(mysql_error()); } } } } } and the piece of code to choose the colors <?php $color_list = explode("+", $color); for ($i=0;$i<count($color_list);$i++) { ?> <option value="<?php echo $color_list[$i]; ?>"><? echo $color_list[$i]; ?></option>
  6. Hi.. i'm building my own shipping cart for a shop in PHP/MySQL. i saw many forums and i saw one who sugests to put the colors separeted by "+" and then separete with explode(), it works fine until when i add two equal products with the same ID, but with different colors it adds to the database with the same ID and then when i delete a product he deletes the two. How can i turn it arround? I would like for them to be different produts in the shipping cart. I would apreciate any sugestion Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.