</when>
} else { # pg_NumRows() > 0 ==> user is member of >1 projects
- $query = sprintf("DELETE from junction where person = %d AND project = %d",
+ $query = sprintf("DELETE from junction where person = %d AND project = '%s'",
$id,
addslashes($context));
pg_exec($dbh, $query) or die ("Cannot delete junction.");
if ($primproject == $context) {
$row = pg_fetch_array($sth, 0);
+ # Set the first other project as primary project and reset the admin flag
$query = sprintf ("UPDATE person SET project = '%s',admin=0 WHERE id = %d",
addslashes ($row['project']),
$id);