How to use where and or_where in ignited datatables with codeigniter -


it's not working @ ->or_where('text like',"%dog%"). i'm using make json format view in datatable please me!

       $this->datatables->select('id,name,text,profile_image_url') //ignited datatables         ->unset_column('id')         ->unset_column('profile_image_url')         ->unset_column('name')         ->unset_column('text')         ->add_column('profile_image_url', '<img src="$1"/>', 'profile_image_url')         ->add_column('name','$1','name')         ->add_column('text','$1','text')         ->where('text like',"%cat%")         ->or_where('text like',"%dog%")         ->from('posts');         echo $this->datatables->generate(); 

it's not working cause have invalide syntax, using ->where means comparing if column equal second parameter, use function syntax should be

$this->db->like('text', 'cat'); $this->db->like('text2', 'dog');  

but if want control wildcard (%) placed, can use optional third argument. options 'before', 'after' , 'both' (which default).

$this->db->like('title', 'match', 'before');  // produces: title '%match'    $this->db->like('title', 'match', 'after');  // produces: title 'match%'   $this->db->like('title', 'match', 'both');  // produces: title '%match%' default 

hope you


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -