开发者

Unexpected { expected (? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow开发者_开发问答 situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

Parse error: syntax error, unexpected '{', expecting '(' in /home/a7237281/public_html/include/session.php on line 313

this is the error i get, relating to this code

      //check the emails
  $field = "email";  //Use field name for email
  $field2 = "email2";
  if(!$subemail || strlen($subemail = trim($subemail)) == 0)
  {
     $form->setError($field, "* Email not entered");
  }
  else if
  {
     /* Check if valid email address */
     $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
             ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
             ."\.([a-z]{2,}){1}$";
     if(!eregi($regex,$subemail))
     {
        $form->setError($field, "* Email invalid");
     }
     else if ($subemail !== $subemail2)
     {
        $form->setError($field2, "* Emails does not match");
     }
     $subemail = stripslashes($subemail);
  }
  /* Check if email is already in use */
  else($database->emailTaken($subemail))
  {
    $form->setError($field, "* Email address already in use");
  }

And its referring to the { after the first else if.

I have edited with the entire piece of code, what could i do now?


Of course it is. You forgot to give a condition. Are you sure you meant else if and not just else?


Either put a condition for the if

else if(something ?!)

or remove the if so it reads

else
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜