Erreur: ce groupe existe déjà
"; else { $r = pg_query("SELECT MAX(idgroupe) FROM groupe"); if($a = pg_fetch_array($r)) $newid = $a[0]+1; else $newid = 1; pg_query("INSERT INTO groupe(idgroupe, name, roles) VALUES($newid, '".$_POST['name']."', 0)"); } } else if(isset($_POST['act']) && $_POST['act'] == 2) { $r = pg_query("SELECT name FROM groupe WHERE idgroupe = ".$_POST['id']); if(($a = pg_fetch_array($r)) === false) { echo "Mauvais id
\n"; } else { $uroles = 0; foreach($_POST as $k => $v) if(is_int($k) && ($v == 'on' || $v == 1 || $v = 'checked')) $uroles += 1 << $k; pg_query("UPDATE groupe SET roles = $uroles WHERE idgroupe = ".$_POST['id']); } } $r = pg_query("SELECT idgroupe, name FROM groupe"); if($a = pg_fetch_array($r)) { ?>id | nom | ".$a['idgroupe']." | ".$a['name']." | \n"; $a = pg_fetch_array($r); $bline = !$bline; } echo "
---|