Ukendt fejl i shoppingsystem
Jeg får nogle produkter udskrevet fra min produkt_tabel.. Der kan man så tilføje de forskellige produkter til min shopping_tabel..Men det fungere ikke som det skal, da alle de FØRSTE der er udskrevet af mine produkter ikke kan tilføjes i shopping_tabel på en eller anden måde..
Lidt kode:
Produkter:
<?
$query = mysql_query("SELECT * FROM cybertape_product WHERE cat_id='$_GET[cat_id]' ORDER BY prod_name ");
while ($row = mysql_fetch_array($query)) {
$prod_id = $row[prod_id];
$cat_id = $row[cat_id];
$prod_name = $row[prod_name];
$prod_quantity = $row[prod_quantity];
$prod_price = $row[prod_price];
$prod_price_sale = $row[prod_price_sale];
$prod_description = $row[prod_description];
$prod_image = $row[prod_image];
?>
<tr>
<td align="center" style="font-size: 13px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: gray; border-right-width: 1px; border-right-style: dashed; border-right-color: gray;">
<a href='index.php?cat_id=<? echo $_GET[cat_id] ?>&action=add&ID=<? echo $prod_id ?>'>Tilføj kurv</a><br>
<a href="product_info.php?ID=<? echo $prod_id ?>">Info</a>
</td>
<td width='80%' valign='top' style="font-size: 13px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: gray; border-right-width: 1px; border-right-style: dashed; border-right-color: gray;">
<a style="color:black" href='product_info.php?ID=<? echo $prod_id ?>'><b><? echo $prod_name ?></b></a><br>
<? echo $prod_description ?><br>
<div align='right'><? echo $prod_price; if ($prod_price_sale == '0.00') { echo "";} else { echo "<font color='red'>($prod_price_sale)</font>"; } ?> DKK<br></div>
</td>
<td align="center" width='10%' style="font-size: 13px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: gray; border-right-width: 1px; border-right-style: dashed; border-right-color: gray;">
<a href="#" onclick="window.open('images/products/3.jpg','newWin',config='width=368,height=300,scrollbars=no,toolbar=no,status=no,location=no,menubar=no,directories=no')">
<? if ($prod_image == '') { echo "<img src='images/tape1.jpg' border='0' width='50' height='50'>";} else { echo "<img src='images/category/$prod_image' width='63' height='51' border='0'></a>"; } ?></a>
</td>
</tr>
<?
}
?>
shoppingcart.php, som er includet i index´.php
if (isset($_GET['action']) == ("add")) {
if (isset($_GET['ID'])) {
$cat_id = $_GET['cat_id'];
$session_id = $_COOKIE['cybertape_shopping'];
$prod_id = $_GET['ID'];
$_POST[now] = time();
$query = mysql_query("SELECT * FROM cybertape_product WHERE prod_id='$prod_id'");
while ($row = mysql_fetch_array($query)) {
$prod_name = $row[prod_name];
$prod_price = $row[prod_price];
$prod_price_sale = $row[prod_price_sale];
$prod_weight = $row[prod_weight];
mysql_query("INSERT INTO cybertape_shopping (session, prod_name, prod_id, prod_price, prod_price_sale, prod_weight, date) values ('$session_id', '$prod_name', '$prod_id', '$prod_price', '$prod_price_sale', '$prod_weight', '$_POST[now]')");
$_SESSION[customer] = $prod_name;
header("location: product.php?cat_id=$cat_id");
}
} else { echo "FEJL"; }
}
Hvis der er en der ku fortælle mig fejlen evt. ligger ville jeg blive super glad :)
