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..?!?!
//Life motto
if (sad() == true) {
sad().stop();
develop();
}