![]() |
Similar entries function. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Similar entries function. (/showthread.php?tid=71623) |
Similar entries function. - HarrysR - 09-06-2018 I'm trying to create a "similar entries" function in codeigniter but the code so far gets me an error.. Controller Code: $data['similar'] = $this->pet_model->get_similar($pet_entry_id); Model Code: public function get_similar($pet_entry_id){ The php error shows that these values are blank: Code: SELECT * FROM `pets` WHERE `category_id` = AND `pet_status` = I think that the issues comes from the queries... But where..?!?! ![]() RE: Similar entries function. - Wouter60 - 09-06-2018 $this->db->get() does not return a field value from your table, but just a database object. To get the value of the field: PHP Code: $pet_type = $this->db->get()->row()->pet_type; RE: Similar entries function. - HarrysR - 09-06-2018 (09-06-2018, 07:58 AM)Wouter60 Wrote: $this->db->get() does not return a field value from your table, but just a database object. I think it works fine! Thank you! |