Jump to content

Cannot continue?


GummyGod

Recommended Posts

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);
}
 
 
?>
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.