![]() |
Unknown column 'stud.id' in 'where clause' - 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: Unknown column 'stud.id' in 'where clause' (/showthread.php?tid=76576) |
Unknown column 'stud.id' in 'where clause' - cjvdg - 05-27-2020 Hi! I encounter the error "Unknown column 'stud.id' in 'where clause'. I don't have any stud.id in my files and also in my database. What do you think the problem with this? I'm using Codeigniter 4. Below is my code on my Controller: Code: $model = new Mod_Stud(); Code for my Model: Code: protected $table = 'stud'; RE: Unknown column 'stud.id' in 'where clause' - xdev - 05-30-2020 You did not specify the primary key in your model. I checked the documentation and it shows that when you use `update()` the first parameter should be the primary key indicated in your model. Assuming your primary key is stud_id. You should add this line to your model. PHP Code: $primaryKey = 'stud_id'; |