인 경우 단어에 사용자 자격 증명을 사용하고 유효성을 검사해야하는 다음과 같은 기능이 있습니다. 유효하다면 db에 삽입하십시오. 일단 삽입되면 성공적으로 삽입되었는지 확인하십시오. 그렇지 않으면 false를 반환합니다. 전자 메일이 처음부터 유효하지 않은 경우 false를 반환합니다. Eclipse + Aptana 플러그인이 마지막 else 섹션의 구문 오류를보고합니다. 코드를 합리화하려고 할 때 올바르게 작동해야하는 것 같습니다.Else 문 구문 오류가
public function storeUser($name, $email, $password) {
$uuid = uniqid('', true);
$hash = $this->hashSSHA($password);
$encrypted_password = $hash["encrypted"]; // encrypted password
$salt = $hash["salt"]; // salt
if((filter_var($email, FILTER_VALIDATE_EMAIL)) && preg_match('/@.+\./', $email)); { //validate the email
$result = mysql_query("INSERT INTO users(unique_id, name, email, encrypted_password, salt, created_at) VALUES('$uuid', '$name', '$email', '$encrypted_password', '$salt', NOW())");
// check for successful store
if ($result) {
// get user details
$uid = mysql_insert_id(); // last inserted id
$result = mysql_query("SELECT * FROM users WHERE uid = $uid");
// return user details
return mysql_fetch_array($result);
} else {
return false; //unsuccessful store
}
else { //THIS IS LINE 45
//not a valid email
return false;
}
}
}
그것은 다음과 같은 오류 반환 :
05-23 11:07:10.758: E/JSON(1601): <b>Parse error</b>: syntax error, unexpected T_ELSE in <b>/home/content/40/8529140/html/webapps/projects/functions/DB_Functions.php</b> on line <b>45</b><br />
05-23 11:07:10.758: E/JSON Parser(1601): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
45 번 라인은 무엇입니까? – Neal
코드에서 내 주석보기 – KDEx
코드를 제대로 들여 쓰기해야합니다. 누락되었거나 쓸모없는 대괄호를 찾는 데 도움이됩니다. – acme