Hi Guys
Below code is from user.php.
I echo the variable being passed to it from user_find.php (as a test) and I see it, therefore the passing of variable $ID from user_find.php to user.php is correct.
Heres my code:
class User
{
public function getUserById($ID)
{
echo $ID;
$sql = "SELECT first_name, last_name, display_name FROM users WHERE user_id = .$ID";
$results = mysql_query($sql);
$row = mysql_fetch_array($results);
$this->user_id = $ID;
$this->first_name = $row['first_name'];
$this->last_name = $row['last_name'];
$this->display_name = $row['display_name'];
}
public function getDisplayName()
{
return "{$this->display_name}" . "{$this->user_id}";
}
}
The getDisplayName() function doesn't return the value in {$this->display_name} for some reason but does for the {$this->user_id} variable and I am not sure why?
Again, the return statement in getDisplayName() returns the user_id variable but not the display_name variable??
What could be the problem?
Thanks
Nick