![]() |
Db query Ci3 to Ci4 - 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: Db query Ci3 to Ci4 (/showthread.php?tid=80308) |
Db query Ci3 to Ci4 - CodingInCodeigniter - 10-15-2021 I not winning with simple tasks in CodeIgniter 4, instead of explaining the many errors and things ive tried, i thought i would try a different approach. Can you please tell me how to write the following in Ci4 Code: function login($username,$password) Ive read the following and none seem to help me: https://forum.codeigniter.com/thread-76383.html https://codeigniter.com/user_guide/database/query_builder.html#selecting-data https://codeigniter.com/user_guide/models/model.html#manual-model-creation Its either the database connection is not available or in the following case: Code: <?php InvalidArgumentException admin is not a valid database connection group. RE: Db query Ci3 to Ci4 - includebeer - 10-16-2021 If it says admin is not a valid connection group, then it is what it is. Double check you db config. Here is an example of what you can do for your login() function in your model: PHP Code: function login($username,$password) RE: Db query Ci3 to Ci4 - CodingInCodeigniter - 10-16-2021 Thank you. ill try this however, admin is a column in my database and not the of my db so i would have anything to do with the db config file... right ? I was just going through the recipe tutorial on your website ![]() RE: Db query Ci3 to Ci4 - includebeer - 10-16-2021 (10-16-2021, 09:24 AM)CodingInCodeigniter Wrote: however, admin is a column in my database and not the of my db so i would have anything to do with the db config file... right ?$DBGroup is only used if you want your model to connect to a different database than the default config. Otherwise, you have nothing special to do and it will automatically connect to the default db. See these 2 pages for more info : DB Config: https://codeigniter.com/user_guide/database/configuration.html Model: https://codeigniter.com/user_guide/models/model.html#connecting-to-the-database If admin is a column then you can add it to the select. Otherwise it will select *. PHP Code: $this->select('admin') (10-16-2021, 09:24 AM)CodingInCodeigniter Wrote: I was just going through the recipe tutorial on your websiteCool. Let me know if you have any question. |