mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows等期望参数 1 是资源
我正在尝试从MySQL表中选择数据,但我收到以下错误消息之一:
mysql_fetch_array() 期望参数 1 是资源,给定布尔值
这是我的代码:
$username = $_POST['username'];
$password = $_POST['password'];
$result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');
while($row = mysql_fetch_array($result)) {
echo $row['FirstName'];
}