This question already has an answer here:
I want to create a code to check if username already exists on server or not using MySQL and PHP. The code:
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT username FROM Servers where email=".$user_info['email']."";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
//username exists
}
else
{
//...
}
I keep getting this error:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
</div>