Hi all,
If I am being incredibly dense, apologies - I am shattered, and just trying to get this script finished.
I have created a function that when called (via a href) will delete a particular record from the db.
This is the function:
function deleterec($id)
{
$link = mysql_connect("$db_host","$db_user","$db_pass");
mysql_select_db("$db_name",$link);
$query="DELETE from mytable WHERE id = '$id'";
echo "Record no. $id has been deleted!";
return $query;
}
Then to call it, I have a link (part of the loop that displays all records, and this link is below each record, specifying that record's ID)
echo "<a href=\"{$_SERVER['PHP_SELF']}" ."?action=deleterec&id=$id\">Delete record no. $id</a>"
I think I am missing something in the syntax, but my brain is too tired to comprehend what it is. Any ideas?
TIA
Jonathen