Codeigniter 4 unique value for single user - 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: Codeigniter 4 unique value for single user (/showthread.php?tid=77170) |
Codeigniter 4 unique value for single user - Dr3am3rz - 07-28-2020 I have a form to let user to register their IGN for a few games. I would like to make the IGN unique, meaning User A can have ignA for any games that he is playing into the database. If User B were to register his IGN in the database using any of the IGN registered by User A, it will show error as that is unique. But I have no clue how do I go about doing this. After searching for so long, I have managed to find this but I am not sure whether is it what I am looking for. I have tried and I get an error and I can't figure out what's wrong with the string. Below is my code : Code: public function game_reg() Hope someone out there can help me on what and how do I do a check for this case. Thanks in advance guys! RE: Codeigniter 4 unique value for single user - paulbalandan - 07-28-2020 It seems you are not capturing the user_id form element. RE: Codeigniter 4 unique value for single user - ojmichael - 07-28-2020 PHP Code: acc_id' => 'required|is_unique' You have no parameters for is_unique on this line. |