I want to have a multipurpose page that allows the user a second chance before they peminantly delete something. I think this should work (Although I am completely new to all this). However I keep gettin the following error:
Parse error: syntax error, unexpected $end in C:\wamp\www\deleteeventt.php on line 61
which means I am missing a { or a } or something along those lines, but I just can't spot it!
Maybe it's completely wrong altogether?
Here it is anyway:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="">
<head>
<title>The Internet Joke Database</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
if (isset($_GET['delete'])): // If the user wants to delete an event
{
// Delete the event event from the events table
// and also delete that events from the attendance table.
$EventCode = $_GET['EventCode'];
$ok1 = @mysql_query("DELETE FROM events WHERE EventCode='$EventCode'");
$ok2 = @mysql_query("DELETE FROM attendance WHERE EventCode='$EventCode'");
if ($ok1 and $ok2)
{
echo '<p>Event deleted successfully!</p>';
}
else
{
echo '<p>Error deleting Event from database!<br />'.
'Error: ' . mysql_error() . '</p>';
}
echo '<p><a href="viewallevents.php">Return to view all events</a></p>';
}
else: // Default page display
{
//Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'pass');
if (!$dbcnx)
{
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
//select the prototype database
if (!@mysql_select_db('prototype'))
{
exit('<p>Unable to locate the ARD ' .
'database at this time.</p>');
}
echo '<p> Are you sure you would like to delete this event? </p>';
// When clicked, this link will delete the event
echo '<p><a href="' . $_SERVER['PHP_SELF'] .
'?delete=1">Yes</a></p>';
//If the user changes their mind it will bring them bact to vie all events
echo '<p><a href="viewallevents.php">Cancel</a></p>';
}
?>
</body>
</html>
Please please please tell me what I am doing wrong!