I'm doing a search and filtering it with $this->input->get('tags')
.
The problem I have is that the data with which I will filter is in a table from 1 to many, where one can have multiple data.
The tables I have in the database are:
This would be my model for the search of the object, here I am still not filtering because the values are concatenated.
$where = array('Year Created', 'Thumbnail Patch', 'Tags', 'Categories');
$this->db->select('objects.*, GROUP_CONCAT(mvalues.value SEPARATOR ", ") as value, GROUP_CONCAT(mdescriptor.name SEPARATOR ", ") as name')
->from('objects')
->join('metadata_values mvalues','mvalues.idObject = objects.idObject')
->join('metadata_descriptors mdescriptor', 'mvalues.idDescriptor = mdescriptor.idDescriptor');
$this->db->where('objectType', 'EMBED');
$this->db->where_in('mdescriptor.name', $where);
$this->db->group_by('objects.idObject');
$this->db->order_by($sort, $by);
$this->db->limit($limit, $page);
$result = $this->db->get();
return $result->result();
And this is the result of the previous model (showing only where the values that interest me are).
If the URL is the ?tags=Adornment
Should only show me the results that have tags and their value is adornment but how are they concatenated as I could do in this case?