1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <?php
if(isset($_POST["fonction"]))
{
connexion();
if( $_POST["fonction"] == "modif")
$result = request('UPDATE domaines SET nom = "'.$_POST["nom"].'", description = "'.$_POST["desc"].'" WHERE id_domaine = '.$_POST["id_domaine"]);
else if( $_POST["fonction"] == "suppr")
$result = request('DELETE FROM domaines WHERE id_domaine = '.$_POST["id_domaine"]);
else if( $_POST["fonction"] == "ajout"){
$nb_max = request('SELECT max(id_domaine) FROM domaines');
$row = mssql_next_result($nb_max);
$new_id = $row[0] + 1;
$result = request('INSERT INTO domaines (id_domaine, nom, description) VALUES ('.$new_id.',"'.$_POST["nom"].'","'.$_POST["desc"].'") ');
};
close_connexion();
}
?> |