我不知道为什么它给我die()消息[重复]

I am trying to search the database to see if the username is already taken. I know there are a lot of stuff on 'how to check' but I would like help on why it is giving me the die('Error getting information'); message. I'm not sure if its my query or what.

This is my PHP

$conn = new mysqli($servername, $username, $password, $dbname);

$username = $_POST["username"];

$sqlget = "SELECT username FROM users WHERE $username = username";
$sqldata = mysqli_query($conn, $sqlget) or die('Error getting information');
$sql_row_count = mysqli_num_rows($sqldata);


if ($sql_row_count > 0) {
  echo 'Records found!';
} else {
  echo 'No records found!';
}

So when I enter a username and click submit it will show me "Error getting information" Could you guys tell me why?

</div>

$sqlget = "SELECT username FROM users WHERE $username = username";

Should be:

$sqlget = "SELECT username FROM users WHERE username ='$username'";

Though you should bind the $username as you're vulnerable to SQL Injections.