I need to update an array into mysql table.
this is my array
[cat2] => Array
(
[0] => 34
[1] => 48
[2] => 49
[3] => 46
)
and I want my output as 34,48,49,46 to move into a table called shops and column called category. This is code I written, $shop['cat2'] contains the array i posted above. Please help me. This code is keep only 34 in all fields of column category
foreach ($shop['cat2'] as $k => $v) {
$query = "UPDATE shops SET categories2=$v";
mysql_query($query);
}