I have a user table, where the user is currently logged on and has not upload a photo (that the image column in user table is empty) images shown are Default.png. and if the user has uploaded the picture then the image is displayed.
what wrong in my code?
this is my table 'user' on my database (i'm sorry i can't write database structure in here).
| id | gb_user | = | 1 | me.jpg |
this view (headers.php):
<?php $user_log = info_user_login();?>
<?php if(!empty($user_log->gb_user) == NULL):?>
<img class="img-circle" src="../assets/img/default.png" width="70" style="margin:20px 0 0 10px;">
<?php else:?>
<img class="img-circle" src="../assets/img/<?php echo $user_log('gb_user');?>" width="70" style="margin:20px 0 0 10px;">
<?php endif;?>
this helper:
function info_user_login(){
$CI = & get_instance();
$CI->load->model('admin/setting_adm');
$get_data_login = $CI->setting_adm->get_data_log_user();
return $get_data_login;
}
and this model :
function get_data_log_user(){
$id_login = $this->session->userdata('id');
$this->db->where('id', $id_login);
$this->db->from('user');
$q = $this->db->get();
return $q->result();
}
Where ID = session_id_login