<?
//connect to mysql
//change user and password to your mySQL name and password
mysql_connect("localhost","******","******");
//select which database you want to edit
mysql_select_db("*******");
//If cmd is not hit
if(!isset($cmd))
{
//display all the news
$result = mysql_query("select * from Cars");
//run the while loop that grabs all the news scripts
while($r=mysql_fetch_array($result))
{
//grab the title and the ID of the enws
$Title=$r["Title"];//take out the title
$Id=$r["Id"];//take out the id
echo "<a href='delete.php?cmd=delete&Id=$Id'>$Title - Delete</a>";
echo "<br>";
}
}
?>
<?
if($cmd=="delete")
{
$sql = "DELETE FROM Cars WHERE Id=$Id";
$result = mysql_query($sql);
echo "Row deleted!";
}
?>
It shows up all the information, however when I press delete it does not do anything. Any suggestions?
Thanks