I have a fairly simple assignment for a class where I have various pages, but one process page that adds a user to a database. If the user already exists, I need an error message to display. I have the username a a unique field, but I still have to check using msqli_num_rows and it isn’t working. I have this code, which is giving me a parse error on the first line:
$query=$connection,“Select * from users where username=mysqli_real_escape_string($connection,$_POST[“username”])”;
$result= mysqli_query($query);
$num=mysqli_num_rows($result);
if ($num > 0) {//Username already exist
$errormessage = $errormessage . “Username already exists!<br />” );
}
I have other error messages that work fine.
Any suggestions?
Thank you.