here is a little code:
function setList ($to, array $array)
{
DELETE FROM list WHERE A = $to;
foreach ($array as $id)
{
INSERT INTO LIST ($to, $id);
}
}
setList (2, []);
setList (2, [1,2,3,4]);
setList (2, [2,3]);
setList (2, [3,4,5,6]);
this is to update a list, but to avoid duplicate entries - remove all first. Its MyIsam, so basically no way to use transactions. Is there a way to delete+insert at the same time?