たとえば、ユーザーが製品を作成し、それをカテゴリに割り当てます。
カテゴリには、いくつかの記録があります。
-phone, id:0
-computer, id:1
-pad, id:2
ユーザーが製品を作成し、製品にカテゴリを割り当てる必要があり、ユーザーは次のようにします。
name:iphone
cat:0
そして、フローは次のようになります。
1. check the cat is exist in db or not
2a. if not exist prompt error
2b. if exist, put the record in db.
しかし、ステップ 1 のチェックを終えて、2b が開始される前にチャンスはありますか。管理者は電話カテゴリを削除します。これが発生した場合、データベースは cat id watch を持たないレコードを挿入します。データベースには次のようなものがあります。
*-phone, id:0* (not any more, because the admin delete it)
-computer, id:1
-pad, id:2
しかし、次のような記録があります。
name:iphone //but it belong to no category, because the admin delete it.
cat:0
これを行う機会がある場合、どうすればこれを回避できますか? ありがとうございました。
(codeigniter で php と mysql を使用)