Hi guys
I have the following error
Parse error: syntax error, unexpected T_ELSE in /home/sites/maypolejuniors.com/public_html/subscribe.php on line 171
from the following code
<?php
include_once('includes/connect.php');
//assign form entries from subscription form to variables
$email=$_POST["form_email"];
$name=$_POST["form_name"];
$status=$_POST["form_subscribe2"];
echo ("status ".$status);
if($status=="1"){
$result="$sql = 'SELECT * FROM `email_table` where `email`=$email";
//is the email address already subsribed
if(mysql_num_rows($result) > 0)
{
//The email address already exists in the table, output message
echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter');
}
}
else //if not then enter into database
{
$sql="INSERT INTO `email_table` (`name`,`email`) VALUES ('".$name."', '".$email."')";
if (!mysql_query($sql,$con)){
die('Error: ' . mysql_error());
}
else
{
echo($name. ' who has '.$email.' as their email address has successfully subscribed to the Maypole Juniors newsletter');
}
}
else //line 171
{
echo("Do something else");
$sql="DELETE FROM email_table WHERE email='".$email."'";
if (!mysql_query($sql,$con)){
die('Error: ' . mysql_error());
}
else
{
echo($name. ' who has '.$email.' as their email address has successfully unsubscribed from the Maypole Juniors newsletter');
}
}
mysql_close($con);
?>
Any ideas what I have done wrong