mysql_fetch_assoc() expects parameter 1 to be resource......
Posted: Sat Jan 14, 2012 10:46 am
I Tried Creating A Profile Page!
But i always get an error : "Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\php\Profile\core\inc\user.inc.php on line 28"
But i always get an error : "Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\php\Profile\core\inc\user.inc.php on line 28"
<?php
// fetches all of the users from the table!
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 ;
}
function fetch_user_info ($uid) {
$uid = (int)$uid;
$sql = "SELECT
`user_username` AS `username`
`user_firstname` AS `firsntame`
`user_lastname` AS `lastname`
`user_email` AS `email`
`user_about` AS `about`
`user_location` AS `location`
`user_gender` AS `gender`
FROM `users`
WHERE `user_id`= ($uid)" ;
$result = mysql_query ($sql) ;
return mysql_fetch_assoc ($result) ; //THIS LINE HAS AN ERROR!
}
?>