you can select the proposed entry first to see if it exists already. then only insert it if is not already there. it
$sql = "select * from myguestbookdb where name='$name' and comment='$comment' and date='$date'"; // or whatever
$result = pg_exec($db, $sql); //postgres stuff, convert to mysql or whatever
if(pg_numrows($result) == 0) // are there no rows meeting this select?
{
//insert yer guestbook stuff here
}
// else, just ignore it so you only get one insert...