function getImage()
{
$session_data = $this->session->userdata('sessiondata');
$id = $session_data['user_id'];
$this->db->where('user_id',$id);
$r=$this->db->get('tbl_usrs');
if($r->num_rows()>0)
{
foreach ($r -> result_array() as $row) {
$data[] = $row;
}
}
$r->free_result();
return $data;
//print_r($data);
}} //class ends
hello everone i am new to php codeigniter while displaying image from database i am getting error Severity: Notice
Message: Undefined variable: img
don't know why error is...
cotroller
public function index() {
if($this->session->userdata('is_login')) {
$session_data = $this->session->userdata('sessiondata');
$id = $session_data['user_id'];
//$img = $session_data['profile_picture'];
//echo $img;
//echo "hahahahaaaaaaaaa";
$this->load->model('Display_profilepicture');
//echo '<br>'."hm";
$data = $this->Display_profilepicture->getImage();
//echo '<br>'."hmmmm";
//echo count($data);
//print_r($data);//nothing printed
//$img="some";
$data['profile_picture']=array('profile_picture'=>$img);
//print_r( $data);
//header("Content-type: image/jpg");
$this->load->view('my_profile',array('data'=>$data));
}
any help will be appreciated
//model