I am pulling a list of products from my MYSQL database and using a delete button against each product in case the operator wants to delete the product.
The problem is th
$link=mysqli_connect("localhost","root","","smartcart");
$prod="select * from products";
$rw=mysqli_query($link,$prod) or die(mysqli_errno()."in query $prod");
$count=1;
while($row=mysqli_fetch_assoc($rw))
{
echo "";
echo "".$count." ";
echo "".$row['prod_id']." ";
echo "".$row['prod_name']." ";
echo "".$row['prod_price']." ";
echo " ";
$count=$count+1;
}
for delete action code in delete_prod.php
if(isset($_GET['delete']))
{
include "connection.php";
$prod_id=$_REQUEST['prod_id'];
$del="delete from products where prod_id=$prod_id";
if (mysqli_query($link,$del))
{
echo "Successfully deleted";
unset($_GET['delete']);
}
else
{
echo "Delete operation Failed";
}
header('location:show_db.php');
}
try this...
- 热议问题