Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
I'm having problem with my code on a line. An error pops up ,
Error :
Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\Patient Registration\server.php on line 23.
Please help.
I have tried to delete and alter what I could but nothing happened. Line 23 is the bold'ed' };
EDITED : Thanks for those who replied but can you guys check my code again? I encountered different errors this time.
Errors :
Notice: Undefined index: username in C:\xampp\htdocs\Patient Registration\server.php on line 14
Notice: Undefined index: email in C:\xampp\htdocs\Patient Registration\server.php on line 15
Notice: Undefined index: password in C:\xampp\htdocs\Patient Registration\server.php on line 16
Notice: Undefined index: password_confirm in C:\xampp\htdocs\Patient Registration\server.php on line 17
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Patient Registration\server.php on line 36
Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) in C:\xampp\htdocs\Patient Registration\errors.php on line 15
php
session_start();//Variables declared
$username ="";
$email="";
$errors = array();//Connect to database
$db = mysqli_connect('localhost','root','','patient')ordie("Could not connect to the database");//Registeration area
$username = mysqli_real_escape_string($db, $_POST['username']);
$email= mysqli_real_escape_string($db, $_POST['email']);
$password = mysqli_real_escape_string($db, $_POST['password']);
$re_password = mysqli_real_escape_string($db, $_POST['password_confirm']);//Errors popupif(empty($username)|| empty($email)|| empty($password)){
array_push($errors,"Required field");}if($password != $re_password){
array_push($errors,"Password must match");}//Existing username check
$user_check_query ="SELECT * FROM patient WHERE Patient Name = '$username' or Patient Email = '$email' LIMIT 1";
$result = mysqli_query($db, $user_check_query);
$user= mysqli_fetch_assoc($result);if($user){if($user['username']=== $username){
array_push($errors,"Username has already been used");}if($user['email']=== $email){
array_push($errors,"Email has already been used");}}//Successful registrationif(count($errors)==0){
$passwordhash = md5($password);//Password encryption
$query ="INSERT INTO patient (Patient_Name, Patient_Email, Password) VALUES ('$username', '$email', '$password')";
mysqli_query
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
This question already has an answer here:
I'm having problem with my code on a line. An error pops up ,
Error :
Please help.
I have tried to delete and alter what I could but nothing happened. Line 23 is the bold'ed' };
EDITED : Thanks for those who replied but can you guys check my code again? I encountered different errors this time.
Errors :
Notice: Undefined index: username in C:\xampp\htdocs\Patient Registration\server.php on line 14
Notice: Undefined index: email in C:\xampp\htdocs\Patient Registration\server.php on line 15
Notice: Undefined index: password in C:\xampp\htdocs\Patient Registration\server.php on line 16
Notice: Undefined index: password_confirm in C:\xampp\htdocs\Patient Registration\server.php on line 17
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Patient Registration\server.php on line 36
Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) in C:\xampp\htdocs\Patient Registration\errors.php on line 15