Like or dislike feature allows both but want to limit one vote per user - 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: Like or dislike feature allows both but want to limit one vote per user (/showthread.php?tid=82112) |
Like or dislike feature allows both but want to limit one vote per user - AgBRAT - 06-13-2022 I am trying to implement a like (unlike) or dislike (undislike) feature to my image upload site. I am using AJAX to accomplish this and so far I have been able to limit users to one view of each upload page but I cannot restrict users to one vote of like OR dislike. They can do both currently. The problem is in my model ActionModel.php:
PHP Code: public function insertAction(array $request) RE: Like or dislike feature allows both but want to limit one vote per user - InsiteFX - 06-13-2022 Add a database field for ( voted intenger 1 = voted 0 = not voted. ) Then you can check this field to see if they voted or not. RE: Like or dislike feature allows both but want to limit one vote per user - luckmoshy - 06-14-2022 (06-13-2022, 11:58 PM)InsiteFX Wrote: Add a database field for ( voted intenger 1 = voted 0 = not voted. ) Yes I didi as @InsiteFX it is working fine Of course I recommend from @InsiteFX |