Welcome Guest, Not a member yet? Register   Sign In
Undefined property
#3

The problem is this line doesn't return what you think it does

PHP Code:
return $this->db->get('product'); 

You need to Generate Query Results from the returned value - they cannot be read directly. You need something along these lines

PHP Code:
$this->load->model('Product');
$rows $this->Product->get_product()->result(); 
foreach(
$rows as $row){
... 


Or, you could have the model return an actual result set

PHP Code:
function get_product()
{
 
      $this->load->database();
 
      return $this->db
                        
->get('product')
 
                       ->result();



Then your controller code would work as shown in your original post.
Reply


Messages In This Thread
Undefined property - by suchanon - 12-16-2018, 04:14 AM
RE: Undefined property - by donpwinston - 12-16-2018, 07:36 AM
RE: Undefined property - by dave friend - 12-16-2018, 08:37 AM
RE: Undefined property - by suchanon - 12-16-2018, 05:39 PM
RE: Undefined property - by dave friend - 12-17-2018, 08:19 AM
RE: Undefined property - by suchanon - 12-17-2018, 08:22 PM
RE: Undefined property - by dave friend - 12-17-2018, 09:11 PM
RE: Undefined property - by suchanon - 12-17-2018, 11:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB