Hi, Below i have a simple shopping cart(very basic),what i wish to do is have it so that a person can remove an item they dont want, I've tried delete queries but for some reason it deletes all the content...the fields in the cart table are email and dvd_id. if anyone could help me with this it would be much appriciated...thanks in advance.
-AD
<?php session_start();
if(empty($_SESSION['email'])) {
die('Your must be Logged to view this page. <a href=customerlogin.php>login </a>');
}
?>
<html>
<body>
<p align='center'><font face="Courier"><b><font size="5">Your Shopping Cart</font> </b></font></p>
<?php
$email=$_SESSION['email'];
$db="test";
$link = mysql_connect("localhost");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$query = "SELECT * From cartdvds WHERE email='$email'";
$result = mysql_query($query);
echo "<div align=center><table bordercolor=#000000 border=0 width=100% cellspacing=0>\n";
echo "<tr>
<td width=12% height=41><span style=font-weight: 400>
<font size=4 face=Courier></font></span></td>
<td width=10%><span style=font-weight: 400>
<font size=4 face=Courier></font></span></td>
<td width=30%><span style=font-weight: 400>
<font size=4 face=Courier></font></span></td>
<td width=15%><span style=font-weight: 400>
<font size=4 face=Courier></font></span></td>
</tr>\n";
while ($row = mysql_fetch_array ($result)) {
$dvd_id=$row['dvd_id'];
$query1 = "SELECT * From dvds WHERE dvd_id='$dvd_id'";
$result1 = mysql_query($query1);
while ($row1 = mysql_fetch_array ($result1)) {
$dvd_name=$row1['dvd_name'];
echo" <tr>
<td ><font size=4 face=Courier> </font></td>
<td ><font size=4 face=Courier><img src='{$row1["thumb"]}'></font><p></p></td>
<td ><font size=4 face=Courier><b>{$row1["dvd_name"]}</b>
</br>{$row1["dvd_price"]}
</br><b>{$row1["synopsis"]}</b></font></td>
<td >remove </td>
</tr>\n\n";
}
}
echo '</table>'
?>
</body>
</html>