<?php
$conn = db_connect();
$sql = "delete from ".PAGE_ASOC." where first_id = '$_POST[id]' or second_id = '$_POST[id]'";
$result = mysql_query($sql, $conn);
for ($cnt=0; $cnt<count($_POST['inc']); $cnt++)
{
$sql = "insert into ".PAGE_ASOC."
(first_id, second_id)
values
('$_POST[id]', '".$_POST['inc'][$cnt]."')";
$result = mysql_query($sql, $conn);
}
redirect($_SESSION['goback']);
?>