You are trying to call PHP from the client-side, in the browser, like you would javascript. PHP only runs on the server-side. I really suggest you get a good understanding of this issue before continuing.
What's happening is this ...
When the user navigates to the page, the server runs PHP and parses the code into HTML, and then delivers it to the browser on the client-side.
In order to interact with PHP (and MySQL) from the browser, info has to be sent back to the server ... the sort of link you would want could be ...
echo '<a href="delete.php?id='.$id.'>delete</a>';
where ...
1) delete.php does the interacting with the database and can either display a message, or return to the previous page or whatever. It would contain ...
mysql_query("DELETE FROM guestbook WHERE ID='$id'");
A lot of people would send the info back to the same page (the one that lists the table in the first place) with something like ...
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$id.'>delete</a>';
... and put a switch at the top of the page, before any HTML ...
if($GET['action'] == 'delete'){
mysql_query("DELETE FROM guestbook WHERE ID='".$GET['action'] ."'");
}
2) You'd need 1 link for each row (all the $id's) using this method.
See how you get on. There will hundreds of tutorials dealing with exactly this sort of thing ... try putting [tutorial php mysql] in google.
P.S. Who's going to be able to delete records? Are you logging them in, etc.