how to give error user already exists in php code example
Example: how to check user already exists in php
$sql = "SELECT username FROM table_name WHERE username='{$username}'";
$result = mysqli_query($con,$sql) or die("Query unsuccessful") ;
if (mysqli_num_rows($result) > 0) {
echo "Username is already exist";
} else {
...............
}