Question
My datatabase name is dbtest and the table is name is users. For some reason the code isn't working correctly. The information is not being
My datatabase name is dbtest and the table is name is users. For some reason the code isn't working correctly. The information is not being stored in the database and it is not showing any errors when password and confirm password are different and when the chracter length exceeds 25 characters. I have no idea what I am doing wrong. Thank you for your help.
$connect = msql_connect("localhost", "root", ""); mysql_select_db("dbtest"); $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'"); $count = mysql_num_rows($namecheck); if($count!=0) { die ("Username already taken!"); } // all feilds filled if ($username&&$email&&$firstname&&$lastname&&$password&&$confirmpassword) { // making sure that password and confirm password are the same if ($password == $confirmpassword) { if(strlen($username) > 25 || strlen($firstname) >25 || strlen($lastname) > 25) { echo "Length of username, first name, or last name is too long"; } else { if (strlen($password) > 25 || strlen($password) < 6) { echo "Password should be between 6 and 25 characters"; } else { // registering the user $queryreg = mysql_query("INSERT INTO users VALUES (' ', '$username', '$lastname', '$firstname', '$password')"); die("You have been registered! Return to sign in page"); } } } else echo "Yor passwords do not match!"; } else echo"Please fill in all fields!"; } } ?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started