Welcome Guest, Not a member yet? Register   Sign In
Similar entries function.
#1

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){
   $this->db->select('category_id');
   $this->db->from('pets');
   $this->db->where('pet_entry_id', $pet_entry_id);
   $pet_type = $this->db->get();

   $this->db->select('pet_status');
   $this->db->from('pets');
   $this->db->where('pet_entry_id', $pet_entry_id);
   $pet_status = $this->db->get();

   $query = $this->db->get_where('pets', array('category_id' => $pet_type, 'pet_status' => $pet_status) );
   return $query->result_array();
 }

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..?!?! Tongue

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply


Messages In This Thread
Similar entries function. - by HarrysR - 09-06-2018, 07:50 AM
RE: Similar entries function. - by Wouter60 - 09-06-2018, 07:58 AM
RE: Similar entries function. - by HarrysR - 09-06-2018, 08:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB