just to update on progress. this is my current solution which is bringing out an error:
$username = $_SESSION['username'];
foreach($_POST['activity_checkbox'] as $value){
$sql = 'INSERT INTO supportactivityuser (`username`, `supportactivity_id`) VALUES ("'.$username.'", "'.$value.'")
ON DUPLICATE KEY UPDATE supportactivity_id = $value';
$result = mysql_query($sql, $connection) or die(mysql_error());
}
foreach($_POST['expert_checkbox'] as $value){
$sql = 'INSERT INTO expertuser (`username`, `expert_id`) VALUES ("'.$username.'", "'.$value.'")
ON DUPLICATE KEY UPDATE expert_id = $value';
$result = mysql_query($sql, $connection) or die(mysql_error());
//execute your query
}
the resulting error message is
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON DUPLICATE KEY UPDATE supportactivity_id = $value'
here is my revised table structure with the multi column keys:
http://www.mindseyemidlands.co.uk/notts_quality/info_resource/multicolumn.gif