Hi I have a little issue with my functions in my libraries folder that I created. I can not seem to get the user id. Not sure what it should be if i am using tank auth?
I use codeigniter and tank auth.
function getAuthorName($id) {
$ci =& get_instance();
$ci->db->select()->from('users')->where('id', $user_id);
$result = $ci->db->get()->result_array();
return $result[0]['username'];
}
function getAuthorAvatar($id){
$ci =& get_instance();
$ci->db->select()->from('users')->where('id', $user_id);
$result = $ci->db->get()->result_array();
return $result[0]['avatar_link'];
}
There is a mistake in your where-clause. try:
$ci->db->select()->from('users')->where('id', $id);