Web サイトでユーザー スキルを検索する検索システムを構築しています。このスキルはトークンとして表示されます。ユーザー スキルのデータベース テーブルは次のようになります。
id=> primary id(auto increment),
user_id=> this is the user id,
competence_nom=> this is the skill name,
competence_id=> this is the skill parent id
したがって、2 つのスキル (またはそれ以上) が 1 人のユーザーに属している場合、表示は次のようになります。
user name + skill one + skill two
このようではありません(私が今達成していること)
user name +skill one
user name +skill two
jQuery tokeninput プラグインを使用してトークン データをサーバー側に渡します。スキル ID をサーバー側に渡し、サーバー側で jQuery tokeninput によって指定されたスキル配列を展開します。
$comps=explode(",", $_POST["competences"]);
次に、これを foreach ループに入れます。
foreach($comps as $i=>$v){
}
そして、これは私が悪い出力を得る場所です:
user name +skill one
user name +skill two