Welcome Guest, Not a member yet? Register   Sign In
displaying an image from a database
#1

[eluser]Unknown[/eluser]
Hi all,

I'm building a project of a shopping website. I want to view the product's image. my code is as follows:

in the controller:

Code:
public function monitor()
{  

  $this->load->helper('html');
// static entry of the parameter for the test
                $this->db->where('type',1);
  $screen['query']= $this->db->get('product');
  $this->load->view('screen_view',$screen);
}


in the view:

Code:
<?php    
    foreach($query->result() as $row)
{
    echo heading("name",1);
    echo img($row['image']);  
}
?>
But what i get is an error messsage :
Fatal error: Cannot use object of type stdClass as array in C:\xampp\htdocs\Qpixil\app\views\screen_view.php on line 63 (the line of echoing the heading).

I'm sure it's not a problem in the helper, bec. i tested by echo a static heading inside the foreach and it worked.

can anyone help




Theme © iAndrew 2016 - Forum software by © MyBB