codeigniter-base-model
codeigniter-base-model copied to clipboard
Order by Appending
I am trying to use Order by after the following query
$this->remote_jobs->get_many_by($jobs_params);
right now above query result is
SELECT * FROM hm_jobs WHERE company_id = '1' AND user_id = '6'
I want to add order by within this query... how I will do it?
this should work:
$this->remote_jobs->order_by('field_to_order_by', 'ASC')->get_many_by($jobs_params);
Thanks, it works. 👍
How I will use WHERE LIKE clause for fetching records from table based on this WHERE LIKE?
It doesn't look like this is implemented currently.
You probably want to copy the order_by function (https://github.com/jamierumbelow/codeigniter-base-model/blob/master/core/MY_Model.php#L747) into a new function for where_like and reference the codeigniter documentation (https://codeigniter.com/user_guide/database/query_builder.html#looking-for-similar-data)