Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement



PHP Snippet 1:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users 
  WHERE id="$uid"');

PHP Snippet 2:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users
  WHERE id=?');

PHP Snippet 3:

$stmt = $con->prepare('SELECT username, rank, id, steamid, avatar FROM users WHERE id = ?');

$stmt->bind_param('i', $uid);
//set parameters and execute
$uid = 'value here';
$stmt->execute();

$stmt->close();