PHP problem.... I need help guys
I tried running the below script and gives this error on line 35 concerning the mysqli_query Error: Parse error: syntax error, unexpected 'mysqli_query' (T_STRING) in C:\xampp\htdocs\server.php on line 35 Here is the script: <?php $username = ""; $email = ""; $errors = array(); //connecting to the database $db = mysqli_connect('localhost', 'root', '', 'registration'); //if the register button is clicked if (isset($_POST['register'])) { $username =mysql_real_escape_string($_POST['username']); $email =mysql_real_escape_string($_POST['email']); $password_1 =mysql_real_escape_string($_POST['password_1']); $password_2 =mysql_real_escape_string($_POST['password_2']); //ensure that form fields are filled properly if (empty($username)) { array_push($errors, "username is requied"); // add error to errors array } if (empty($email)) { array_push($errors, "Email is requied"); // add error to errors array } if (empty($password_1)) { array_push($errors, "Password is requied"); // add error to errors array } if ($password_1 != $password_2) { array_push($errors, "The two passwords does not match"); // add error to errors array } // if ther are no errors, save user too database if (count($errors == 0)) { $password = md5($password_1); //encrypt password before storing in database (security) $sql = "INSERT INTO users (username, email,password) VALUES ('$username', '$email', '$password');" mysqli_query($db, $sql); } } ?>