Hello folks,
Hopefully this will be an easy one for most of you guys. I don't delve into PHP much so I'd appreciate some help.
The aim of the script below is to display a collection of rows with the aim of specifying one for eventual deletion.
It returns the "row deleted" echo fine, but doesn't actually delete anything.
-
<?
-
include("connect.php");
-
-
if(!isset($cmd))
-
{
-
$result = mysql_query("select * from events order by eventName");
-
-
while($r=mysql_fetch_array($result))
-
{
-
-
$title=$r["eventName"];
-
$id=$r["eventNumber"];
-
$location=$r["eventLocation"];
-
$date=$r["eventDate"];
-
-
echo "<span class='smalltitle'>$title</span><br><span class='bodytext'>$location<br>$date</span><br> ";
-
echo "<a href='delete_event.php?cmd=delete&id=$id'>$title - Delete</a><br><br>";
-
-
}
-
}
-
?>
-
-
<?
-
if($_GET["cmd"]=="delete")
-
{
-
$sql = "DELETE FROM events WHERE eventNumber=$id";
-
$result = mysql_query($sql);
-
echo "Row deleted!";
-
}
-
?>
-
Many thanks.