Bonjour,
Voici mon pb, j'ai une requête pour insérer des valeurs dans ma base (mysql).
Lorsque je l'écris dans php myadmin pas de pb, mais dans mon php elle ne fonctionne pas, certainement un soucis avec mes post ou get.
Voici mon code si quelqu'un aurait une piste.
mon fichier XXXX.class.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 static function set_ModifDateComment($LGN_NUM,$AST_NUM,$COM_DATE,$COM_COMMENTAIRE,$LGN_USER) { //requete permettant de modifier la date de validation du suivi des pièces des dossiers de formation. $req = " INSERT INTO COMPLETER2(LGN_NUM,AST_NUM,COM_DATE,COM_COMMENTAIRE,LGN_USER) VALUES ('".$LGN_NUM."',$AST_NUM,'".$COM_DATE."','".$COM_COMMENTAIRE."','".$LGN_USER."') "; $res = dbAcces::Query($req); }mon fichier index.php de ce XXXX.class.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 static function get_TabEtapes($AST_NUM) { $MonModelLigne = db_suiviformation::get_LigneEtape($AST_NUM); //tableau permettant d'afficher les différentes étapes du suivi du dossier de formation. ?> <form id="suivdoss" method="post" action="" ><br/> <fieldset> <legend>Suivi du dossier</legend> <table border= "0" cellpadding="2"> <th></th> <th></th> <th></th> <th></th> <th></th> <th><center> Date </center></th> <th><center> Commentaire </center></th> <?php foreach ($MonModelLigne as $LGN_NUM => $UneLigne) { ?> <tr> <td><input type="hidden" name="AST_NUM[<?php echo $_GET['AST_NUM']; ?>]" value="<?php echo $UneLigne['AST_NUM']; ?>" <td><input type="hidden" name="LGN_NUM[<?php echo $_GET['AST_NUM']; ?>][<?php echo $UneLigne['LGN_NUM']; ?>]" value="<?php echo $UneLigne["LGN_NUM"]; ?>"/></td> <td><input type="hidden" name="LGN_USER[<?php echo $_GET['AST_NUM']; ?>][<?php echo $UneLigne['LGN_NUM']; ?>]" value="<?php echo $UneLigne["LGN_USER"]; ?>"/></td> <td><b><?php echo $UneLigne["LGN_LIBELLE"]; ?></b></td> <td><input type="checkbox" name="COM_DATECHECK[<?php echo $UneLigne['LGN_NUM']; ?>]" onClick="document.getElementById('COM_DATE').value = new Date().toLocaleString(); document.getElementById('COM_COMMENTAIRE').focus();"/><td> <td><center><input type="text" id="COM_DATE" name="COM_DATE[<?php echo $_GET['AST_NUM']; ?>][<?php echo $UneLigne['LGN_NUM']; ?>]"</center></td> <td><input type="text" id="COM_COMMENTAIRE" name="COM_COMMENTAIRE[<?php echo $_GET['AST_NUM']; ?>][<?php echo $UneLigne['LGN_NUM']; ?>]" value="<?php echo $UneLigne["COM_COMMENTAIRE"]; ?>"/></td> <tr> <?php } ?> </table> </fieldset> <br/> <tr> <td colspan="3" align="center"><input type="submit" value="Enregistrer" name="Enregistrer"/> <input type="button" value="Imprimer" name="Imprimer" onClick="window.print()"/> <input type="button" value="Retour" name="Retour" onClick="history.back()"/></td> </tr> </form> <?php }
les appels entre les deux fonctionne car d'autre fonction s'applique, certainement un pb dans mon code car je débute en php. Car lorsque je fais un var_dump($_POST) il me met (Array, '1 ou l'AST_NUM qui correspond', 'Array, 'Array', 'Array').
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 if($_POST["Enregistrer"]) { db_suiviformation::set_ModifDateComment($_POST["LGN_NUM"],$_GET["AST_NUM"],$_POST["COM_DATE"],$_POST["COM_COMMENTAIRE"],$_POST["LGN_USER"]); }
merci par avance, si vous avez une piste.
Partager