I am trying to do this sql query on codeigniter
SELECT* FROM person WHERE type = 'staff' AND description LIKE 'university%'
I am not sure if it is correct...
$this->db->get_where('person' , array('type'=>'staff'))
->like('description','university%')
->result_array();
does anyone have an idea about my case? thanks in advance ...
Using Active Record you can do so
$query = $this->db->select('*')
->from('person')
->where('type','staff')
->like('description','university','after')
->get();
$result = $query->result_array();
Make sure you pass after
as a third parameter in like()
function so active record will add the wild card i.e %
after university
so it will look like LIKE 'university%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With