bonjour ;
s'il vous plait j'ai un probleme je viens de modifier les champs dans bdd en réalisant ce code ,en cliquant sur modifierle resultat donne connexion OK , modification avec succés mais rien ne change dans ma bdd , aidez moi svp voila j'ai séparé le code dans une page j'ai
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 <?php session_start(); try { $bdd = new PDO("pgsql:host=localhost;dbname=stage", "postgres", "123"); echo 'Connexion OK'; } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } $id = $_SESSION['id']; $nom_user = $_POST['nom_user']; $ville = $_POST['ville']; $region_user = $_POST['region_user']; $etat = $_POST['etat']; $couleur = $_POST['couleur']; $reponse = $bdd->prepare("update projets set nom_user = '$nom_user' , ville = '$ville' , region_user = '$region_user' ,etat = '$etat', couleur = '$couleur' where id_projet = $id "); if($reponse) { echo "<script> alert('Modification avec succéq!! ') </script>"; } else { echo "<script> alert('Erreur de modification! ') </script>"; } $reponse ->execute(array()); //header('location:../admin.php'); ?> **************************************** et dans l'autre page j'ai <?php session_start(); try { $bdd = new PDO("pgsql:host=localhost;dbname=stage", "postgres", "123"); } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } $id = $_GET['id']; $_SESSION['id'] = $id; $reponse = $bdd->prepare("SELECT * FROM projets where id_projet='$id'"); $reponse->execute(); $tab = $reponse->fetch(); ?> <form name="f1" method="POST" action="script/updateprojet.php"> <tr> <td> Nom : </td> <td> <input name="nom_user" style="width:160px;" type='text' id="name" value="<?php echo $tab['nom_user']; ?>" placeholder="Enter le nom" maxlength="20" class='float'/> </td> </tr><br></br> <tr> <td> VILLE : </td> <td><input name="ville" style="width:160px;" type='text' id="name" value="<?php echo $tab['ville']; ?>" placeholder="Enter la ville" maxlength="20" class='float'/> </td> </tr> <tr><br></br> <td> REGION : </td> <td><input name="region_user" style="width:160px;" type='text' id="name" value="<?php echo $tab['region_user']; ?>" placeholder="Enter la region" maxlength="20" class='float'/> </td> </tr><br></br> <tr> <td> ETAT : </td> <td><input name="etat" style="width:160px;" type='text' id="name" value="<?php echo $tab['etat']; ?>" placeholder="Enter l'auteur" maxlength="20" class='float'/> </td> </tr><br></br> <tr> <td> COULEUR : </td> <td><input name="couleur" style="width:160px;" type='text' id="name" value="<?php echo $tab['couleur']; ?>" placeholder="Enter la ville" maxlength="20" class='float'/> </td> </tr><br></br> <tr> <td> </td> <td><input name="submit2" type="submit" class="btn_submit_vert" value="Modifier"/> </td> </tr> </form>
Partager