I have successfully uploaded an image path with an image name in my database. But when it comes to display it doesn't work. I have filed profilepic in my DB.I don't know where I am going, wrong please help to sort.
// Controller
public function index() {
if($this->session->userdata('is_login')) {
$this->load->model('Display_profilepic');
$data = $this->Display_profilepic->getImage();
print_r($data);//nothing printed
$data=array('profile_picture'=>$img);
$this->load->view("my_profile",$data);
}
// model Display_profilepic
function getImage(){
$id = $this->session->userdata('user_id');
$this->db->select("*");
$this->db->from('tbl_usrs');
$this->db->where('user_id', $id);
$query = $this->db->get();
if($query->num_rows()==0)
echo("Picture not found!");
else{
$data = $query->row_array();
return $data['profile_picture'];
print_r($data['profile_picture']);//nothing printed
I have a seprate controller and model for inserting the image into the DB where the path is defined. Let me know if I should post that also.