![]() |
Problem with like function in query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Problem with like function in query (/showthread.php?tid=92385) |
Problem with like function in query - rubik - 01-28-2025 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? RE: Problem with like function in query - kcs - 04-17-2025 Maybe this would help? https://codeigniter.com/user_guide/database/queries.html#db-escapelikestring |