[eluser]Unknown[/eluser]
Hey guys, hello... I started with MVC yesterday and with CI too...
Im amazed with all functions and power that tools give to me!
But now Im stucked at this library.. I installed all the things and its working in my site template very nice. But now im trying to return profiles fields that I customized in MYSQL.
Look, 1) I've added the field AVATAR in the user_profile table.
2) I found the function function get_profile_field($user_id, $fields) on user_profile model.
3) I put the model at autoload and its ok.
3) And so, I tried to return the field on my website with this command, that I found on the user_profile model:
function get_profile_field($user_id, $fields)
{
$this->db->select($fields);
$this->db->where('user_id', $user_id);
return $this->db->get($this->_table);
}
Then I call as:
<?=$this->user_profile->get_profile_field(2, 'avatar');?>
Where 2 is a test ID of one of my users that have value in the field 'avatar'.
But that error ocurrs:
A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysql_result could not be converted to string
Filename: painel/home.php
Line Number: 9
What can I do to solve this??
Whats the easy way to return the profiles fields?
I need to create functions at the user profile model?
Thx for everything!