Welcome! Log In Create A New Profile

Advanced

user.php page for Portfolio

Posted by 46107894 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/17/2019 02:24PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
user.php page for Portfolio
October 06, 2012 09:32AM
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
Sorry, only registered users may post in this forum.

Click here to login