Model Returns Null on FindAll |
Hi, sorry I could not find a solution, but it looks like you did everything correctly.
If you don't extend the Model you should load the database like this: https://codeigniter.com/user_guide/model...l-creation Also you are a subject to SQL injection, that can access all your data (or delete it) with that SQL query. You should use query bindings: https://codeigniter.com/user_guide/datab...y-bindings
Good Day
Thanks for the advice. Been using as advised worked fine. I will update if i find the problem. Just another quick question When using Curl Request to consume Soap Services how do i get function within the body. As the body returns a list of functions that i should be able to invoke but I'm new to curl was using SoapClient on CI3. (05-12-2020, 09:16 PM)I was facing this same problem just recently, the problem I had was the database, you need to set deleted_at (if using) to default NULL, because find and findAll query add WHERE deleted_at IS NULL, so, that solved my problemremesses_thegreat Wrote: Good Day Everyone. Please urgently help with My Model. I want to get users from table users in db. Model returns Null/ array(0). Below is my code for the controller and model. Thanks in advance
Turn of softdelete if dont use deleted_at
Code: $useSoftDeletes = false (05-12-2020, 09:16 PM)I was facing this same problem just recently, the problem I had was the database, you need to set deleted_at (if using) to default NULL, because find and findAll query add WHERE deleted_at IS NULL, so, that solved my problemremesses_thegreat Wrote: Good Day Everyone. Please urgently help with My Model. I want to get users from table users in db. Model returns Null/ array(0). Below is my code for the controller and model. Thanks in advance
The reason why is because of the protected $useSoftDeletes = true; comment it or set it to false;
[i]If you have protected $useSoftDeletes=true;. I just faced the same issue until I realized that my database at the deleted_at field does not accept null values, so I had to set 'deleted_at timestamp null default null' in my migrations file so that the database accepts null values at the deleted_at field, which allows me to retrieve all records with deleted_at=null in the database when using find, where, or findAll queries.[/i]
|
Welcome Guest, Not a member yet? Register Sign In |