Hvad er der galt når der står dette: Column: 'id' in where clause is ambiguous
koden er denne:
<?php
if (!empty($_POST['sel_item_id'])) {
//connect to database
require("mysql.php");
$conn = mysql_connect($server, $brugernavn, $adgangskode)
or die(mysql_error());
mysql_select_db($database,$conn)
or die(mysql_error());
//valider varer samt hent navn og pris
$get_iteminfo = "SELECT name FROM inventory WHERE id ='".$_POST['sel_item_id']."'";
$get_iteminfo_res = mysql_query($get_iteminfo)
or die(mysql_error());
if (mysql_num_rows($get_iteminfo_res) < 1) {
//ikke gyldig id, drop det
header ("Location: indhold.php");
exit;
} else {
//hent info
$name = mysql_result($get_iteminfo_res,0,'name');
if(!empty($_COOKIE['xxxxx.dk'])) {
//føj info til cart-tabellen
$addtocart = "INSERT INTO store_shoppertrack (sel_item_id, sel_item_qty, sel_item_size, sel_item_price, date_added, id) VALUES ('".$_POST['sel_item_id']."', '".$_POST['sel_item_qty']."', '".$_POST['sel_item_size']."', '".$_POST['sel_item_price']."', now(), '".$_COOKIE['xxxxx.dk']."')";
mysql_query($addtocart);
} else {
//føj info til cart-tabellen
$addtocart = "INSERT INTO store_shoppertrack (sel_item_id, sel_item_qty, sel_item_size, sel_item_price, date_added) VALUES ('".$_POST['sel_item_id']."', '".$_POST['sel_item_qty']."', '".$_POST['sel_item_size']."', '".$_POST['sel_item_price']."', now())";
$find_id = "SELECT id FROM store_shoppertrack WHERE sel_item_id='".$_POST['sel_item_id']."' AND sel_item_qty='".$_POST['sel_item_qty']."' AND sel_item_size='".$_POST['sel_item_size']."' AND sel_item_price='".$_POST['sel_item_price']."'";
mysql_query($addtocart);
$find_id = mysql_fetch_array(mysql_query($find_id));
setcookie("xxxxx.dk", $find_id['id']);
}
//vidersend til showcart_side
?>
<html>
<head>
<title>This page has moved... Denne side er flyttet!</title>
<meta http-equiv="Refresh" content="0;URL=showcart.php"/>
</head>
<body>
</body>
</html>
<?php
exit;
}
} else {
//send brugeren et andet sted hen
header("Location: indhold.php");
exit;
}
?>
|