Hey All, I am having a hard time learning php. I am trying to delete an item from my database but it isnt working.
I thought I had it working because there was no errors but the item is still in the database.
Here is what I have.
A link to delete.php then I have this for delete.php
<?php
ob_start();
// contact to database
$host = "localhost";
$username = "admin";
$password = "mypassword";
$database="database";
$tbl_name="new_equip";
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query=("SELECT * FROM new_equip");
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$id=$row[0];
mysql_query("DELETE from new_equip WHERE id='$id'");
header("location:inventory.php");
?>
I would also like for it to say something like “Item was successfully deleted” when they get to the inventory.php page.
I know this is probably something simple and I have been searching and trying everything I can find, but I cannot seem to get it working.