User Profiles [part 02] Fetch_Users() function error.
Posted: Sun Aug 19, 2012 12:26 am
				
				I keep getting this error when viewing the user_list.php file:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a8913488/public_html/core/inc/user.inc.php on line 13
and it says this at the very bottom left:
Array()
here is the page live:
awsomechat.comuv.com/user_list.php.
Here is my code:
			Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a8913488/public_html/core/inc/user.inc.php on line 13
and it says this at the very bottom left:
Array()
here is the page live:
awsomechat.comuv.com/user_list.php.
Here is my code:
<?php
//user.inc.php file
session_start();
// SQL stuff.
mysql_connect('mysql_host','username','password');
mysql_select_db('database');
// Get users from table
function fetch_users() {
$result = mysql_query('SELECT `user_id` AS `id`, `user_name` AS `username` FROM users');
$users = array();
while(($row = mysql_fetch_assoc($result)) !== false) {
    $users[] = $row;
}
return $users;
}
?>
I would be glad if someone helped.