What am I doing wrong here folks?
<?php
include 'header.php';
/**
* Display a user's profile
*/
$id = $db->real_escape_string($_GET['id']);
$user_res = $db->query("SELECT * FROM users WHERE id = $id");
$user = $user_res->fetch_assoc();
?>
<h1><?php echo $user['username'] ?>'s Profile</h1>
<?php
include 'footer.php';
?>
Equals to:
Fatal error: Call to a member function real_escape_string() on a non-object in C:\wamp\www\test\profile.php on line 12</pre>