I am trying to add a constraint in MySQL by member, date and question so that the same user cant ask the same question more than once a day.
alter table questions add UNIQUE INDEX three_UNIQUE ( member_id , question , date );
but since the question field is long text, i get this error:
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
any way to get around this?
Thanks!!
It doesn’t usually make much sense to specify a unique key constraint on a user entered long text field. The user can still ask the same question more than once, simply by adding a space or making some other minor change.
If your intention is to prevent accidental reposts then use a hidden field with a GUID or similar unique identifier.