Hello below i have posted my code, when i ran the code i got this message:
But how is it 'unexpected', don't i need that to end the if statement since right after that i go into the else...Parse error: syntax error, unexpected '}' in /home/a1401476/public_html/adduser.php on line 28
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."; } ?>




Reply With Quote