[Skip to main content](#vessel-content)

#   Custom field unique entry

##

- **[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")**
- [![khashiz's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61259-khashiz "View khashiz's Profile") Topic Author
- [ Offline](/forum/user/61259-khashiz)

Less More

- Posts: 240
- Thank you received: 13
-
-

3 years 9 months ago [\#348801](#348801) by [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")  *[Custom field unique entry](/forum/35-orders-management/905802-custom-field-unique-entry#348801 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.6 -- PHP version -- : 8.1  Hi is there any possibiliy that user custom field accepts only unique entries ? I need to ask for users ID card number and two users with the same ID is not allowed")* was created by *[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")*

-- HikaShop version -- : 4.7
-- Joomla version -- : 4.2.6
-- PHP version -- : 8.1

Hi
is there any possibiliy that user custom field accepts only unique entries ?
I need to ask for users ID card number and two users with the same ID is not allowed

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTgwMi1jdXN0b20tZmllbGQtdW5pcXVlLWVudHJ5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86576
- Thank you received: 14319
-
-

3 years 9 months ago [\#348806](#348806) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field unique entry](/forum/35-orders-management/905802-custom-field-unique-entry#348806 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.6 -- PHP version -- : 8.1  Hi is there any possibiliy that user custom field accepts only unique entries ? I need to ask for users ID card number and two users with the same ID is not allowed")*

Hi,

I've never tried it, but that should be possible. Go in your PHPMyAdmin, edit the structure of the hikashop_user table, and add a unique key on your custom field column and it should do it automatically.
[ community.appian.com/support/w/kb/693/kb...rneath%20the%20table](https://community.appian.com/support/w/kb/693/kb-1413-mysql-best-practices---primary-key-or-unique-index-on-every-table#:~:text=Creating%20a%20Unique%20Key%20in,click%20Unique%20underneath%20the%20table).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTgwMi1jdXN0b20tZmllbGQtdW5pcXVlLWVudHJ5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")**
- [![khashiz's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61259-khashiz "View khashiz's Profile") Topic Author
- [ Offline](/forum/user/61259-khashiz)

Less More

- Posts: 240
- Thank you received: 13
-
-

3 years 9 months ago [\#348832](#348832) by [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")  Replied by *[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")* on topic *[Custom field unique entry](/forum/35-orders-management/905802-custom-field-unique-entry#348832 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.6 -- PHP version -- : 8.1  Hi is there any possibiliy that user custom field accepts only unique entries ? I need to ask for users ID card number and two users with the same ID is not allowed")*

I tried to do that but did not managed to.

i got the attached error

unfortunatly i have to experience working with mysql

- [ ![ozhangasht-com-localhost-ozhang&#95;db-ciofl&#95;hikashop&#95;user-phpMyAdmin-4-9-7.png](/forum/attachment/56415) ](/forum/attachment/56415 "...dmin-4-9-7.png") [ ](/forum/attachment/56415?download=1 "...dmin-4-9-7.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTgwMi1jdXN0b20tZmllbGQtdW5pcXVlLWVudHJ5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86576
- Thank you received: 14319
-
-

3 years 9 months ago [\#348833](#348833) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field unique entry](/forum/35-orders-management/905802-custom-field-unique-entry#348833 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.6 -- PHP version -- : 8.1  Hi is there any possibiliy that user custom field accepts only unique entries ? I need to ask for users ID card number and two users with the same ID is not allowed")*

Hi,

The error

> BLOB/TEXT column 'codemelli' used in key specification without a key length

means you need to specify the length you want to take into account for the unique key because the column is of the "text" type.
So for example, you can use the MySQL query: Code:

alter table ciofl_hikashop_user ADD UNIQUE(codemelli(100));

That way, it will only take into account the first 100 characters of the text in codemelli to be unique.
Basically, it depends on the length of the text you expect your users to enter in that field. But it's best to not make it too long.

The following user(s) said Thank You: [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTgwMi1jdXN0b20tZmllbGQtdW5pcXVlLWVudHJ5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")**
- [![khashiz's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61259-khashiz "View khashiz's Profile") Topic Author
- [ Offline](/forum/user/61259-khashiz)

Less More

- Posts: 240
- Thank you received: 13
-
-

3 years 9 months ago [\#348840](#348840) by [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")  Replied by *[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")* on topic *[Custom field unique entry](/forum/35-orders-management/905802-custom-field-unique-entry#348840 "-- HikaShop version -- : 4.7 -- Joomla version -- : 4.2.6 -- PHP version -- : 8.1  Hi is there any possibiliy that user custom field accepts only unique entries ? I need to ask for users ID card number and two users with the same ID is not allowed")*

Thank you very much dear Nicolas.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50LzkwNTgwMi1jdXN0b20tZmllbGQtdW5pcXVlLWVudHJ5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.054 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
