|
-
Apr 7th, 2009, 07:48 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Unexpected } error message?
Hello below i have posted my code, when i ran the code i got this message:
Parse error: syntax error, unexpected '}' in /home/a1401476/public_html/adduser.php on line 28
But how is it 'unexpected', don't i need that to end the if statement since right after that i go into the else...
adduser.php : (i have enlarged line 28 to make it more noticable)
Code:
<?php
if ($_POST[password1] == $_POST[password2]) {
if ($_POST[email1] == $_POST[email2]) {
if ((strlen($_POST[username]) > 0) & (strlen($_POST[username]) < 30)) {
if ((strlen($_POST[password]) > 0) & (strlen($_POST[password]) < 30)) {
if ((strlen($_POST[email]) > 0) & (strlen($_POST[email]) < 30)) {
if ((strlen($_POST[securityq]) > 0) & (strlen($_POST[securityq]) < 50)) {
if ((strlen($_POST[securitya]) > 0) & (strlen($_POST[securitya]) < 30)) {
//-------------
// if (username does not already exist)
include("/Includes/database_info.php");
$con = mysql_connect($servername,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($servername, $con);
$sql="INSERT INTO accounts (Username, Password, Email, SecurityQ, SecurityA)
VALUES ('$_POST[username]','$_POST[password1]','$_POST[email1]','$_POST[securityq]','$_POST[securitya]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo ("Hello " . $_POST[username] . " , welcome to The School Truck.");
mysql_close($con)
// if the username does exist then exit
//-------------
}
else {
echo "The length of your security anwser must be between 1 and 30 characters long.";
}
}
else {
echo "The length of your security question must be between 1 and 50 characters long.";
}
}
else {
echo "If you are getting this message but you have entered your email correctly then please contact us on the appropriate page.";
}
}
else {
echo "The length of your password must be between 1 and 30 characters long.";
}
}
else {
echo "The length of your username must be between 1 and 30 characters long.";
}
}
else {
echo "The two emails you entered did not match.";
}
}
else {
echo "The two passwords you entered did not match.";
}
?>
-
Apr 7th, 2009, 08:36 PM
#2
Re: Unexpected } error message?
look line 25, You're missing a semicolon at the end.
My usual boring signature: Something
-
Apr 7th, 2009, 09:43 PM
#3
Re: Unexpected } error message?
'Unexpected' means that the grammar requires a token before the one the parser is complaining about, so look leftwards and upwards (and you shall find the one dclamp mentions).
-
Apr 8th, 2009, 10:47 AM
#4
Thread Starter
Frenzied Member
Re: Unexpected } error message?
Thank you, i never thought of the unexpected message like that before, though i don't know how i overlooked the missing semi-colon.
This thread is resolved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|