Page 1 of 1

Delete one data from database table

Posted: Wed Jan 19, 2011 9:57 pm
by rickngjh

Code: Select all

shoppingcart.php: 
<a href="delete.php">Delete</a>

delete.php:
<?php 

session_start();

$conn = mysql_connect("localhost" , "root" , "");
    mysql_select_db("dbouterspace" , $conn);
 

$id_row= "1" ;
$query = "DELETE * FROM confirm_order WHERE ItemID = "$_GET['$id_row']""; 
$result = mysql_query($query); 

echo "The data has been deleted.";

header("Location:shoppingcart.php"); 
?> 



Re: Delete one data from database table

Posted: Thu Jan 20, 2011 1:05 am
by iijb
Hi,
Please specify your problem.
I think you are using Get method to get ItemId for the deletion. But you are not passing the ItemId in the url in the delete link of shoppingcart.php

Regards
iijb

Re: Delete one data from database table

Posted: Thu Jan 20, 2011 3:12 am
by thecodewall
maybe this help...

Code: Select all

$query = "DELETE * FROM confirm_order WHERE ItemID = '".$_GET['$id_row']."'"; 
http://codewall.blogspot.com