A query is returning me the following structure:
24 | 24,879
45 | 657,45
77 | 77,15
etc. With php, I can get that to an array, like!
$array = (24=>"24,879",45=>"657,45",77=>"77,15");
Now what I need, is a second query like:
update $table set $col = 24 if $col in (24,879)
More precisely, something like:
foreach($array as $k=>$v) {
mysql_query("update `$table` set `$col` = $k if `$col` in ($v)");
}
Tricky, isn’t it? Help will be appreciated.
EDIT: The query that returns the comma separated things is below:
SELECT n.id, o.email, count( o.email ) AS c,
CAST( GROUP_CONCAT( DISTINCT o.id ) AS char ) AS nid
FROM 0_member AS n JOIN member_base AS o ON o.email = n.login_userid
GROUP BY o.email HAVING c >1
What you need is: