I Fetch this data from Tags Table with comma separated :
trance, house, electronica, dubstep, club
Tags Table Is:
ID NAME ArticleId
1 trance 10
2 house 10
3 electronica 10
4 dubstep 10
5 garage 10
Now I need To UPDATE Tags Table With This New Input For Edit Page:
trance, house, electronica // I remove dubstep, club tag
My PHP Code:
$arr_tag = explode(",",$tag);
foreach($arr_tag as $tags){
DataAccess::put("UPDATE tags SET name = ?, type=? WHERE article = 10",$tags,"news");
}
Now After UPDATE Ouput Is:
trance, trance, trance
My Problem Is: How To UPDATE Tags Table For New Tag Input?
var_dump($tag), andvar_dump($arr_tag)to see what you're working with? As well, note that your update query will simply set ONE tag each time, replacing the tag that was set in the previous update.