[英]how to set unique entry in glocery crud with respect to another field
我試圖通過在codeigniter中使用glocery crud庫在表中添加城市。 所以我使用一個功能
$crud->unique_fields('state');
工作正常。 但是,如果不同國家/地區存在相同的state_name,該如何處理。 我的數據庫表是這樣的
`id` `country_id` `state` `status`
1 1 abc 0
2 2 abc 0
您可以為此創建復合唯一密鑰。
$crud->unique_fields('country_id', 'state');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.