Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: Switch Database
Post: RE: Switch Database

I think one of them could suite you when loading a model (from docs (https://codeigniter.com/userguide3/general/models.html?highlight=base%20model#connecting-to-your-database)): Use this in Controlle...
1,788 Views
3 Replies
04-14-2020, 05:41 AM
cyberstunts
  Thumbs Up Thread: insert, get ID of insert [FIXED: My fault]
Post: RE: insert, get ID of insert [FIXED: My fault]

Thank you, it seems to work both ways. By $db I meant the database connection e.g. PHP Code: -- $db = \Config\Database::connect(); // insert row $record_id = $db->insertID(); -- So you should be...
1,965 Views
3 Replies
04-14-2020, 04:51 AM
cyberstunts
    Thread: Using Entity with model, return empty Object
Post: RE: Using Entity with model, return empty Object

If no records are found, you will get null. Replace where statement with ID to test, e.g. PHP Code: -- $user = $userModel->where('user_id', 1)->first(); -- Otherwise nothing obvious which I c...
1,104 Views
1 Replies
04-13-2020, 08:50 PM
cyberstunts
    Thread: Switch Database
Post: RE: Switch Database

Documentation on Working With Databases (https://codeigniter.com/user_guide/database/connecting.html) provides with 2 straight forward ways: Define groups in configuration Load custom connection ...
1,788 Views
3 Replies
04-13-2020, 05:04 PM
cyberstunts
    Thread: insert, get ID of insert [FIXED: My fault]
Post: RE: insert, get ID of insert [FIXED: My fault]

Documentation "Query Helper Methods" specifies that the correct usage is: PHP Code: -- $db->insertID(); -- and not PHP Code: -- $MyModel->insertID(); -- Can you share the code which worked...
1,965 Views
3 Replies
04-13-2020, 04:06 PM
cyberstunts
    Thread: PHPStorm yellow "Method not found in" notices
Post: RE: PHPStorm yellow "Method not found in" notices

I don't have the solution but can suggest clicking on the small "man in the hat" icon at the bottom right. There you can configure code inspection. I do have plugin installed "CodeIgniter" by Marty...
1,375 Views
3 Replies
04-13-2020, 03:54 PM
cyberstunts
    Thread: Debug is breaking my JSON... How to disable it from some methods ?
Post: RE: Debug is breaking my JSON... How to disable it...

For others looking for solution, just define MIME/"Content-Type" for proper response with all content types if similar functions to "setJSON" doesn't exist. CodeIgniter automatically disables debug...
7,575 Views
8 Replies
04-13-2020, 03:39 PM
cyberstunts

Theme © iAndrew 2016 - Forum software by © MyBB