• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Practical CodeIgniter 3 - A new book coming soon

#39
@kilishan
The model class have two bugs.

find($id) and find_all() need a small fix

PHP Code:
public function find_all()
 
   {
 
       $query $this->db->get($this->table_name);

 
       $rows $this->temp_return_type == 'array' ?
 
                   $query->result_array() :
 
                   $query->result($this->temp_return_type);

 
       $this->temp_return_type $this->return_type;

 
       return $rows;
 
   


PHP Code:
public function find($id)
 
   {
 
       $query $this->db->where($this->primary_key$id)
 
                     ->get($this->table_name);

 
       $row $this->temp_return_type == 'array' ?
 
                   $query->row_array() :
 
                   $query->row(0$this->temp_return_type);

 
       $this->temp_return_type $this->return_type;

 
       return $row;
 
   

I added "db". Without the "db" the code do not return rows Smile
Reply


Messages In This Thread
RE: Practical CodeIgniter 3 - A new book coming soon - by Paradinight - 04-08-2016, 10:22 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.