Problème modification Base de données
Bonjour je suis actuellement en train de créer un site internet pour une association et je voudrais que l'administrateur de la base de données puisse par la suite modifier les adhérents de cette association pour se faire j'ai donc créer une page internet :
Code:
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
| <?
include("_gestionBase.inc.php");
include("_controlesEtGestionErreurs.inc.php");
echo'
<link href="../css/CssMenu.css" rel="stylesheet" type="text/css">
<title></title>
</head>
<body background="fond_jaune2_grain.jpg">
<p align="center"> <a href="/"><img src="deuxieme_jet_copie.gif" alt="" class="logo" border=none /></a></p>';
$connexion=mysql_connect("localhost","root","root")
or die("Connexion au serveur impossible");
$db=mysql_select_db("Association",$connexion)
or die("Sélection de la base de données impossible");
echo"<form action='modif_adherent.php' method='post'>";
$action=$_REQUEST['action'];
$idAd=$_REQUEST['idAd'];
$lgAdh=obtenirDetailAdherent($connexion, $idAd);
$idAd=$lgAdh['idAd'];
$Nom=$lgAdh['NomAd'];
$Prenom=$lgAdh['PrenomAd'];
$DateNaiss=$lgAdh['DateNaissAd'];
$Adresse=$lgAdh['AdrAd'];
$CP=$lgAdh['CPAd'];
$Ville=$lgAdh['VilleAd'];
$TelFixe=$lgAdh['TelFixeAd'];
$TelPort=$lgAdh['TelPortAd'];
$Mail=$lgAdh['MailAd'];
$Annee=$lgAdh['AnneeAd'];
$Cours=$lgAdh['CoursAd'];
$Partners=$lgAdh['Partners'];
$Taille=$lgAdh['TailleAd'];
echo "
<form method='POST' action='modificationAdherent.php?'>
<input type='hidden' value='validerModifAdherent' name='action'>
<table width='85%' cellspacing='0' cellpadding='0' align='center'
class='tabNonQuadrille'>
<tr class='enTeteTabNonQuad'>
<td colspan='3'>$Nom $Prenom (id : $idAd)</td>
</tr>
";
echo '
<tr class="ligneTabNonQuad">
<td> Nom: </td>
<td><input type="text" value="'.$Nom.'" name="nom" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Prenom: </td>
<td><input type="text" value="'.$Prenom.'" name="prenom" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Date de naissance: </td>
<td><input type="text" value="'.$DateNaiss.'" name="dateNaissance" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Adresse: </td>
<td><input type="text" value="'.$Adresse.'" name="adresse"
size="50" maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Code postal*: </td>
<td><input type="text" value="'.$CP.'" name="codePostal"
size="4" maxlength="5"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Ville: </td>
<td><input type="text" value="'.$Ville.'" name="ville" size="40"
maxlength="35"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Téléphone Fixe: </td>
<td><input type="text" value="'.$TelFixe.'" name="telFixe" size ="20"
maxlength="10"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Telephone Portable: </td>
<td><input type="text" value="'.$TelPort.'" name="telPortable" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Adresse Mail: </td>
<td><input type="text" value="'.$Mail.'" name="adresseElectronique" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Annee Entree: </td>
<td><input type="text" value="'.$Annee.'" name="AnneeEntree" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Taille: </td>
<td><input type="text" value="'.$Taille.'" name="taille" size="50"
maxlength="45"></td>
</tr>
<tr class="ligneTabNonQuad">
<td> Cours: </td>
<td>';
if ($Cours=='1')
{
echo "
<input type='radio' name='cours' value='1' checked>
Debutant
<input type='radio' name='cours' value='2'> Intermediaire
<input type='radio' name='cours' value='3'> Confirmé";
}
else if ($Cours=='2')
{
echo "
<input type='radio' name='cours' value='1' >
Debutant
<input type='radio' name='cours' value='2' checked> Intermediaire
<input type='radio' name='cours' value='3'> Confirmé";
}
else
{
echo "
<input type='radio' name='cours' value='1' >
Debutant
<input type='radio' name='cours' value='2' > Intermediaire
<input type='radio' name='cours' value='3' checked> Confirmé";
}
echo'
<tr class="ligneTabNonQuad">
<td> Partners: </td>
<td>';
if ($Partners==1)
{
echo "
<input type='radio' name='partners' value='1' checked>
Oui
<input type='radio' name='partners' value='0'> Non";
}
else
{
echo "
<input type='radio' name='partners' value='1'>
Oui
<input type='radio' name='partners' value='0' checked> Non";
}
echo'
</table>';
echo "
<table align='center' cellspacing='15' cellpadding='0'>
<tr>
<td align='right'><input type='submit' value='Valider' name='valider'>
<FORM ACTION='modif_adherent.php'></p>
</td>
<td align='left'><input type='reset' value='Annuler' name='annuler'>
</td>
</tr>
<tr>
<td colspan='2' align='center'><a href='index.php'>Retour</a>
</td>
</tr>
</table>
</form>";
?> |
Puis la deuxième page où s'éxecute la requete :
Code:
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
| <html>
<head>
</head>
<body background="fond_jaune2_grain.jpg">
<?php
$maconnexion =mysql_connect("localhost","root","root")
or die("Connexion au serveur impossible");
$db=mysql_select_db("Association",$maconnexion)
or die("Sélection de la base de données impossible");
$req="select idAd from adherent where NomAd='$_POST[nom]' and PrenomAd='$_POST[prenom]";
$id=mysql_query($req, $maconnexion);
$Requete="
UPDATE 'Adherent' SET
'NomAd' = '$_POST[nom]',
'PrenomAd' = '$_POST[prenom]',
'DateNaissAd' = '$_POST[dateNaissance]',
'AdrAd' = '$_POST[adresse]',
'CPAd' = '$_POST[codePostal]',
'VilleAd' = '$_POST[ville]',
'TelFixeAd' = '$_POST[telFixe]',
'TelPortAd' = '$_POST[telPortable]',
'MailAd' = '$_POST[adresseElectronique]',
'AnneeAd' = '$_POST[AnneeEntree]',
'CoursAd' ='$_POST[cours]',
'Partners' = '$_POST[partners]',
'TailleAd' ='$_POST[taille]', WHERE 'idAd' ='$id'";
$Resultat=mysql_query($Requete, $maconnexion)
or die("Exécution de la requête impossible");
echo" <b>L'adherent suivant a bien été modifié : </b><br>
<ul>
<li> Nom : $_POST[nom]
<li> Prenom : $_POST[prenom]
<li> Né(e) le : $_POST[dateNaissance]
<li> Adresse : $_POST[adresse]
<li> Code Postal : $_POST[codePostal]
<li> Ville : $_POST[ville]
<li> Tel Fixe : $_POST[telFixe]
<li> Tel Portable : $_POST[telPortable]
<li> Adresse Mail : $_POST[adresseElectronique]
<li> Année : $_POST[AnneeEntree]
<li> Partners : $_POST[partners]
<li> Cours Suivit : $_POST[cours]
<li> Taille : $_POST[taille]
</ul>";
//saisie d'une autre pièce
echo"<a href='creationAdherent.php'><b>Ajout d'un autre adherent ?</b></a><br><br>";
echo"<a href='ListeAdherent.php'><b>Liste des adhérents</b></a ><br><br>";
echo"<a href='../index.php'><b>Retour à la première page</b></a>";
?>
</body>
</html> |
Le problème est que lorsque je valide le message exécution de la requete s'affiche et je n'ai pas trouvé d'où vient mon erreur pourriez vous m'aider svp
Merci d'avance
Cordialement
TiGeR