changing the table name with a variable - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: changing the table name with a variable (/showthread.php?tid=88984) |
changing the table name with a variable - yildzselim - 12-17-2023 Code: class UserModel extends Model Hello, I want to change the table name with a variable, for example the id + _table name of the users coming from the session, how can I do this, thank you. RE: changing the table name with a variable - captain-sensible - 12-17-2023 maybe in principle ..along the lines .no clue if its going to work Code: class UserModel extends Model controller Code: $handle = new UserModel(); RE: changing the table name with a variable - Kaosweaver - 12-19-2023 The base model has a function setTable, we use that to set the table to a different one. RE: changing the table name with a variable - yildzselim - 12-23-2023 Thank you RE: changing the table name with a variable - InsiteFX - 12-23-2023 It's in the Model not the BaseModel. RE: changing the table name with a variable - kenjis - 12-23-2023 https://codeigniter4.github.io/api/classes/CodeIgniter-Model.html#method_setTable |