GummyGod Posted November 23, 2017 Share Posted November 23, 2017 I cannot continue my PHP work because an error (Registration form).Parse error: syntax error, unexpected end of file in ....... on line 7 My PHP code is: <?php $username = ""; $email = ""; $errors = array(); $db = mysqli_connect('localhost', 'root' , '' , 'proiect'); //if register button is clicked if (isset($_POST['register'])){ $username = mysqli_real_escape_string($_POST['username']); $email = mysqli_real_escape_string($_POST['email']); $password_1 = mysqli_real_escape_string($_POST['password_1']); $password_2 = mysqli_real_escape_string($_POST['password_2']); //making sure that they are filled properly if(empty($username)) { array_push($errors,'Username is required'); // added error to errors } if(empty($email)) { array_push($errors,'Email is required'); // added error to errors } if(empty($password_1)) { array_push($errors,'Password is required'); // added error to errors } if($password1 != $password2) { array_push($errors, 'The passwords do not match'); } // if there are no errors save user to datebase if (count($errors) == 0) $password = md5($password_1); $sql = "INSERT INTO USERS (username, email , password) VALUES ('$username' , '$email' , '$password')"; mysqli_query ($db,$sql); } ?> Quote Link to comment Share on other sites More sharing options...
requinix Posted November 24, 2017 Share Posted November 24, 2017 The error message says the file ends on line 7. What you posted is definitely more than 7 lines long. Are you sure you're looking at the right file? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.