Anda dapat mencoba ini -
UPDATE users SET eat = REPLACE(eat, 'banana', '') where eat like '%banana%';
Ini hanya akan menggantikan banana
dari eat
kolom di mana ia hadir.
Perbarui
Ulangi data dan ganti nilai-nilai itu. Ini mungkin membantu -
$check_val = 'banana';
//select those rows first
"select id, eat from users where eat like '%" . $check_val . "%'"
foreach($data as $v) {
$temp= explode(',', $v['eat']);
$temp= array_map(function($t) use($check_val) {
return (strpos($t, $check_val) !== false) ? null : $t;
}, $temp);
$temp = array_filter($temp);
$v['eat']= implode(',', $temp);
"update users set eat= '" . $v['eat'] . "' where eat like '%" . $check_val . "%'"
}