I'm getting the following error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\................www\2\core\inc\user.inc.php on line 9
my code looks like this:
Function fetch_users(){ $result = mysql_query('select `user_id` as `id`, `user_username` as `username` from `users`'); $users = array(); while (($row = mysql_fetch_assoc($result)) !== false){ $users[] = $row; } return $users; }I get the same error message in the following function:
function fetch_user_info($uid){ $uid = (int)$uid; $sql = "select `user_id` as `id`, `user_username` as `username`, `user_firstname` as `firstname`, `user_lastname` as `lastname`, `user_email` as `email`, `user_tel` as `tel`, `user_about` as `about`, `user_gender` as `gender` from `users` where `user_id` = {$uid}"; $result = mysql_query($sql); $info = mysql_fetch_assoc($result); $info['avatar'] = (file_exists("{$GLOBALS['path']}/user_avatars/{$info['id']}.jpg")) ? "core/user_avatars/{$info['id']}.jpg" : "core/user_avatars/default.jpg"; return $info; }I found the following about mysql_fetch_assoc extension:
http://php.net/manual/en/function.mysql-fetch-assoc.php
Is this also the reason for my error or should I be looking somewhere else?
And if this does causes the error how can I get the codes to work?
thanks in advance!
Porkypie