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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.