The 'user.inc.php' has error, as when I navigate to a profile such as http://localhost/members/profile.php?id=7
I get this error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Websites\members\core\user.inc.php on line 33
I have tried to fix the error, but everything I thought would work didn't and in turn created other errors.
Anyone mind giving me a hand with this?
Here is my user.inc.php file
<?php //fetches all of the users from the table. function fetch_users(){ $result = mysql_query("SELECT id AS id, company_name AS company_name FROM trades"); $users = array(); while (($row = mysql_fetch_assoc($result)) !== false){ $users[] = $row; } return $users; } //fetches profile info. function fetch_user_info($id){ $id = (int)$id; $sql = "SELECT id AS id, firstname AS firstname, surname AS surname, company_name AS company_name, email AS email, location AS location, info AS info FROM trades WHERE 'id' = {'$id'}"; $result = mysql_query($sql); return mysql_fetch_assoc($result); } //updates the current users profile info. function set_profile_info($email, $location, $info){ $email = mysql_real_escape_string(htmlentities($email)); $location = mysql_real_escape_string($location); $info = mysql_real_escape_string(nl2br(htmlentities($info))); $sql = "UPDATE 'trades' SET 'email' = '{$email}' 'location' = '{$location}' 'info' = '{$info}' WHERE 'id' = {$_SESSION['id']}"; mysql_query($sql); } ?>Let me know if you require any other files to look at.
Thanks