![]() |
Oracle filter with LIKE method always zero result - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Oracle filter with LIKE method always zero result (/showthread.php?tid=74431) Pages:
1
2
|
Oracle filter with LIKE method always zero result - fauzi26 - 09-22-2019 Hi, Im working with CI and oracle right now but i have difficulties if i use LIKE method. My code like this : Code: $this->db->select('COUNT(*) AS FOUND'); I try to look the query and the result like : Code: SELECT COUNT(*) AS FOUND FROM "ci_r_user_log" WHERE "ul_datetime_login" LIKE '23-09-2019%' I try run the query with SQL Developer and get 4 data found. I checked and it's correct. So why the query that run with CI is not working? But the query is good Im sorry if my english is bad. RE: Oracle filter with LIKE method always zero result - jreklund - 09-23-2019 Just by the looks of it, try this: Code: $this->db->select('COUNT(*) AS FOUND', false); https://codeigniter.com/user_guide/database/query_builder.html#CI_DB_query_builder::select And what is $where in this context? Should be: Code: $this->db->like('ul_datetime_login', '23-09-2019', 'after'); Complete code, as ->get() looked wrong too. Code: $this->db->select('COUNT(*) AS FOUND', false); RE: Oracle filter with LIKE method always zero result - php_rocs - 09-23-2019 @fauzi26, A suggestion... I have found that using query bindings ( https://codeigniter.com/user_guide/database/queries.html#query-bindings ) is easier and causes me less headaches. My only recommendation is that you be very comfortable with writing queries... RE: Oracle filter with LIKE method always zero result - fauzi26 - 09-23-2019 (09-23-2019, 11:40 AM)jreklund Wrote: Just by the looks of it, try this: I try with FALSE but the result is still. The $where is an array contains : PHP Code: $where['"ul_datetime_login" LIKE \''.$date.'%\''] = NULL; I used that code because i've try with LIKE and the result is still zero. ->get() code, i follow in the query builder class. I've used for mySQL and postgreSQL DB and it looks fine. But now when i use oracle DB, it doesnt work. RE: Oracle filter with LIKE method always zero result - fauzi26 - 09-23-2019 (09-23-2019, 12:53 PM)php_rocs Wrote: @fauzi26, I've try to used that, but the result is same. Is something problem with my OCI8 library under xampp maybe? Because i do manually activate the OCI8 library and get the latest library from PECL web RE: Oracle filter with LIKE method always zero result - php_rocs - 09-24-2019 @fauzi26, What version of OCI8? What version of PHP? What version of CI? RE: Oracle filter with LIKE method always zero result - fauzi26 - 09-24-2019 (09-24-2019, 11:18 AM)php_rocs Wrote: @fauzi26, I used OCI8 2.2.0 from PECL Web , PHP 7.2 and CI 3.1 For additional info, i used XAMPP VC15 and Windows 10 Pro RE: Oracle filter with LIKE method always zero result - php_rocs - 09-25-2019 @fauzi26, Have you upgraded anything? Is this the first time that you are having this problem? Did it ever work before? RE: Oracle filter with LIKE method always zero result - fauzi26 - 09-27-2019 (09-25-2019, 08:13 AM)php_rocs Wrote: @fauzi26, I didnt upgrade anything. I usually use mySQL and PostgreSQL, and all work well with my code. And when i used oracle, this things happens. This is my first time use oracle as my dbms RE: Oracle filter with LIKE method always zero result - php_rocs - 09-27-2019 @fauzi26, Can you try running the page with the CI profiler (https://codeigniter.com/user_guide/general/profiling.html#profiling-your-application)? What is the output from it? |