Home > Mobile >  Get result LIKE from 2 column codeingiter
Get result LIKE from 2 column codeingiter

Time:11-25

I Have search quary Like search from 3 column

WHERE t.name Like ? OR t.keywords Like ? OR t.version Like ?

so i search like "program" i get result also if i search "2.2" i got result How can I search with each other like this t.name t.version "program 2.2" and get result!!

CodePudding user response:

Here some example suggestions:

https://forum.codeigniter.com/thread-73265.html

CodePudding user response:

you need to try (or like)

as example

   $this->db->select('*')->from('my_table')
        ->group_start()
                ->where('a', 'a')
                ->or_group_start()
                        ->where('b', 'b')
                        ->where('c', 'c')
                ->group_end()
        ->group_end()
        ->where('d', 'd')->get();

the query will look like this

SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'

this functionality allows you to search in more than one column

  • Related