我正在创建用户个人资料,但发现了一个问题。当我打开网址/链接时,我收到警告:
Warning: mysql_fetch_array() expects parameter 1 to be resource,
boolean given in *localhost/user_profiles/user_list.php* on line 9.
代码是:
<?php
function fetch_users(){
$result = mysql_query(
'SELECT `user_id` AS `id`, `user_username` AS `username` FROM `login`');
$users = array();
while (($row = mysql_fetch_assoc($result)) !== false){
$users[] = $row;
}
return $users;
}
?>