par
JVL » 14 oct. 2013, 15:16
Yep, bon j'ai un peut modifier le code, toujours même soucis, pas d'erreur, mais pas de modification dans la bdd non plus
if(isset($_POST['modifier'])){ // fonction de modification
define('GLPI_ROOT', '..');
include (GLPI_ROOT . "/inc/includes.php");
Session::checkRight("reports", "r");
Html::header($LANG['Menu'][6],$_SERVER['PHP_SELF'],"utils","report"); // appel de l'entête de GLPI
echo 'FONCTION DE MODIFICATION EN CONSTRUCTION</br>';
$id = $_POST['id_suivi'];
$select_modif = $connection->query('SELECT `Projet_suivi`, `Name_suivi`, `Date_suivi`, `Categorie_suivi`, `Duree_suivi`, `Commentaire` FROM `glpi_suivi_travail` WHERE `ID_suivi`= \''.$id.'\' ');
$row = $select_modif->fetch(PDO::FETCH_OBJ);
echo '<form action="action.php" method="POST"> <table class=tab_cadrehov> <tr> <th>Date du jour à modifier </th> <th> Projet sélectionné </th> <th> Catégorie </th> <th>temps travaillé en seconde </th> <th> Commentaire </th> </tr>
<tr> <td> '.$row->Date_suivi.'<input type="text" name="update_date"/> </td>
<td> '.$row->Projet_suivi.'<input type="text" name="update_projet"/> </td>
<td> '.$row->Categorie_suivi.'<input type="text" name="update_categorie" /> </td>
<td> '.$row->Duree_suivi.'<input type="text" name="update_duree" /> </td>
<td> '.$row->Commentaire.' <input type="text" name="update_comm"/> </td>
</tr> <tr> <td> Veuillez utiliser le format année-mois-jour </td> </tr> </table> </br> <center><input type="submit" name="modif" value="Enregistrer la modification"> </center> </form>';
Html::footer();
}
if(isset($_POST['modif'])){
try {
$update = $connection->prepare('UPDATE `glpi_suivi_travail` SET `Projet_suivi`=:upprojet,`Date_suivi`=:update,`Categorie_suivi`=:upcate,`Duree_suivi`=:upduree,`Commentaire`=:upcomm WHERE `ID_suivi`=:upid');
$update->bindParam(':upprojet',$_POST['update_projet'], PDO::PARAM_STR);
$update->bindParam(':update',$_POST['update_date'], PDO::PARAM_STR);
$update->bindParam(':upcate',$_POST['update_categorie'], PDO::PARAM_STR);
$update->bindParam(':upduree',$_POST['update_duree'], PDO::PARAM_STR);
$update->bindParam(':upcomm',$_POST['update_comm'], PDO::PARAM_STR);
$update->bindParam(':upid',$id, PDO::PARAM_STR);
$update->execute();
}
catch (PDOException $e) {
echo 'Error : ' . $e->getMessage();
die();
}
}
Yep, bon j'ai un peut modifier le code, toujours même soucis, pas d'erreur, mais pas de modification dans la bdd non plus
[php] if(isset($_POST['modifier'])){ // fonction de modification
define('GLPI_ROOT', '..');
include (GLPI_ROOT . "/inc/includes.php");
Session::checkRight("reports", "r");
Html::header($LANG['Menu'][6],$_SERVER['PHP_SELF'],"utils","report"); // appel de l'entête de GLPI
echo 'FONCTION DE MODIFICATION EN CONSTRUCTION</br>';
$id = $_POST['id_suivi'];
$select_modif = $connection->query('SELECT `Projet_suivi`, `Name_suivi`, `Date_suivi`, `Categorie_suivi`, `Duree_suivi`, `Commentaire` FROM `glpi_suivi_travail` WHERE `ID_suivi`= \''.$id.'\' ');
$row = $select_modif->fetch(PDO::FETCH_OBJ);
echo '<form action="action.php" method="POST"> <table class=tab_cadrehov> <tr> <th>Date du jour à modifier </th> <th> Projet sélectionné </th> <th> Catégorie </th> <th>temps travaillé en seconde </th> <th> Commentaire </th> </tr>
<tr> <td> '.$row->Date_suivi.'<input type="text" name="update_date"/> </td>
<td> '.$row->Projet_suivi.'<input type="text" name="update_projet"/> </td>
<td> '.$row->Categorie_suivi.'<input type="text" name="update_categorie" /> </td>
<td> '.$row->Duree_suivi.'<input type="text" name="update_duree" /> </td>
<td> '.$row->Commentaire.' <input type="text" name="update_comm"/> </td>
</tr> <tr> <td> Veuillez utiliser le format année-mois-jour </td> </tr> </table> </br> <center><input type="submit" name="modif" value="Enregistrer la modification"> </center> </form>';
Html::footer();
}
if(isset($_POST['modif'])){
try {
$update = $connection->prepare('UPDATE `glpi_suivi_travail` SET `Projet_suivi`=:upprojet,`Date_suivi`=:update,`Categorie_suivi`=:upcate,`Duree_suivi`=:upduree,`Commentaire`=:upcomm WHERE `ID_suivi`=:upid');
$update->bindParam(':upprojet',$_POST['update_projet'], PDO::PARAM_STR);
$update->bindParam(':update',$_POST['update_date'], PDO::PARAM_STR);
$update->bindParam(':upcate',$_POST['update_categorie'], PDO::PARAM_STR);
$update->bindParam(':upduree',$_POST['update_duree'], PDO::PARAM_STR);
$update->bindParam(':upcomm',$_POST['update_comm'], PDO::PARAM_STR);
$update->bindParam(':upid',$id, PDO::PARAM_STR);
$update->execute();
}
catch (PDOException $e) {
echo 'Error : ' . $e->getMessage();
die();
}
} [/php]