I received two associative array and I want to update it's values in mysql db. So, I did this:
// for all other contacts
if(isset($_POST['otherAddress']) || isset($_POST['otherComments']))
{
$otherAddress = $_POST['otherAddress'];
$otherComments = $_POST['otherComments'];
foreach (array_keys($otherAddress + $otherComments) as $key)
{
$query = "UPDATE `boardcontacts` SET
`address`='$otherAddress[$key]',`comments`='$otherComments[$key]'
WHERE `memberID` = '$nID' AND `addressType`='other'";
mysql_query($query);
} // for end
} // if end
Problem is: It duplicate all updated rows with the last index of each array. Any help ?