Oracle filter with LIKE method always zero result |
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.
Just by the looks of it, try this:
Code: $this->db->select('COUNT(*) AS FOUND', false); https://codeigniter.com/user_guide/datab...er::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);
@fauzi26,
A suggestion... I have found that using query bindings ( https://codeigniter.com/user_guide/datab...y-bindings ) is easier and causes me less headaches. My only recommendation is that you be very comfortable with writing queries... (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. (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 (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
@fauzi26,
Can you try running the page with the CI profiler (https://codeigniter.com/user_guide/gener...pplication)? What is the output from it? |
Welcome Guest, Not a member yet? Register Sign In |