Welcome Guest, Not a member yet? Register   Sign In
Problem with like function in query
#1

(This post was last modified: 01-28-2025, 02:56 PM by rubik.)

hi frends
I created a table for categories with these specifications:
'id'=>[
                'type'=>'INT',
                'unsigned'=>true,
                'auto_increment'=>true,
            ],
            'parent'=>[
                'type'=>'INT',
                'unsigned'=>true,
            ],
            'title'=>[
                'type'=>'VARCHAR',
                'constraint'=>'255',
            ],
            'technical'=>[
                'type'=>'TEXT',
                'null'=>true,
            ],
            'memo'=>[
                'type'=>'TEXT',
                'null'=>true,
            ],
            'status'=>[
                'type'=>'INT',
                'default'=>'1',
                'constraint'=>'2',
            ],
I want to display the category content through a datatable and I wrote this query:
$records = $category->select('*')
                ->like('title', $searchValue)
                ->orLike('technical', $searchValue)
                ->orLike('body', $searchValue)
                ->orderBy($columnName, $columnSortOrder)
                ->findAll($rowperpage, $start);
But! As long as the body and technical columns have text data format, it gives an error and does not work, and only when I change their type to varchar does it work.
What should I do to make it work with text type?
Reply
#2

Maybe this would help?
https://codeigniter.com/user_guide/datab...likestring
Reply




Theme © iAndrew 2016 - Forum software by © MyBB