Prevent duplicate record |
Hi
I have a like table that have user_id and comment_id field I need user only can like once each comment and i dont want to check it with SELECT Maybe adjust table column that occur error when insert record? Like primary error I attach my table shot I want only insert record example user_id,comment_id 2,4 for next insert,show error for insert Maybe?
There is no way to check it without using a select.
Code: SELECT EXISTS(SELECT * FROM yourTableName WHERE yourCondition); I would make sure that both columns are index. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-10-2020, 03:07 AM)InsiteFX Wrote: There is no way to check it without using a select.Thanks but I remember we could implement this feature with add key on fields and prevent duplicate records But i dont know how do it
Not sure but this might be what your looking for.
MySQL - Handling Duplicates What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-10-2020, 07:59 AM)InsiteFX Wrote: Not sure but this might be what your looking for. Thank you (06-10-2020, 07:59 AM)InsiteFX Wrote: Not sure but this might be what your looking for.It's working good very thanks |
Welcome Guest, Not a member yet? Register Sign In |