I was hoping someone could tell me how to create a link to delete a specific row from a MySQL database. I have a list of products, and when once sells, I want to be able to click "Delete" so the product is deleted from the database.
I used to know how. But I forgottt. :[[[
pid is the primary key with INT data type.
I want the delete link to be after the link in the echo.
CODE
<?php
require_once('ideas.php');
if (!dbConnect()) {
echo 'Error connecting to database';
exit;
}
$query = "SELECT `pid`, `name`, `desc`, `url`, `image`, `price`, date_format(`date`,'%M %d, %Y') FROM products ORDER BY date DESC";
$result = mysql_query($query) or die(mysql_error());
while(list($pid,$name,$desc,$url,$image,$price,$date)= mysql_fetch_row($result))
{
echo "$pid, <a href='$url'>$name</a>";
}
?>
require_once('ideas.php');
if (!dbConnect()) {
echo 'Error connecting to database';
exit;
}
$query = "SELECT `pid`, `name`, `desc`, `url`, `image`, `price`, date_format(`date`,'%M %d, %Y') FROM products ORDER BY date DESC";
$result = mysql_query($query) or die(mysql_error());
while(list($pid,$name,$desc,$url,$image,$price,$date)= mysql_fetch_row($result))
{
echo "$pid, <a href='$url'>$name</a>";
}
?>
Thanks a ton!
