Bonsoir à tous !
Tout d'abord je tiens à préciser que je suis un amateur en PHP (j'apprend petit-à-petit ^^).
J'ai un souçis, enfete, j'aimerais ajouter une page qui affiche les infos personnelles de la base de donnée pour ensuite les modifier.
Voiçi ce que j'ai essayé de faire mais sa ne donne rien
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
| <?php include ("header.php"); ?>
<?php
// on se connecte à notre base
$base = mysql_connect ('127.0.0.1', 'root', '');
mysql_select_db ('diad', $base);
session_start();
if (!isset($_SESSION['login'])) {
header ('Location: votre_espace.php');
exit();
}
// lancement de la requete
$sql = 'SELECT * FROM membre WHERE id="'.$_SESSION['id'].'"';
// on lance la requête (mysql_query) et on impose un message d'erreur si la requête ne se passe pas bien (or die)
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
// on recupere le resultat sous forme d'un tableau
$data = mysql_fetch_array($req);
// on libère l'espace mémoire alloué pour cette interrogation de la base
mysql_free_result ($req);
mysql_close ();
?>
<div id="wrap" class="container_12"><!--#wrap -->
<div id="slider" class="grid_12"><!-- begin #slider-->
<div id="slider-content"><!-- begin #slider-content-->
<div id="mySlides">
<div class="slide">
<h1>Identifiants</h1>
<p><table width="75%" border="0" align="center" cellpadding="20" cellspacing="20">
<tr>
<td width="27%" align="right">Nom d'utilisateur :</td>
<td width="73%"><input value="<?php echo $_SESSION['login']; ?>" name="login" type="text"></td>
</tr>
<tr>
<td>Mot de passe :</td>
<td></td>
</tr>
</table></p>
<h1>Informations personnelles</h1>
<table width="75%" border="0" align="center" cellpadding="20" cellspacing="20">
<tr>
<td width="32%">Statut :</td>
<td width="68%"><input value="<?php echo $data['status']; ?>" name="status" type="text"></td>
</tr>
<tr>
<td>Nom :</td>
<td><input value="<?php echo $data['nom']; ?>" name="nom" type="text"></td>
</tr>
<tr>
<td>Prénom :</td>
<td><input value="<?php echo $data['prenom']; ?>" name="prenom" type="text"></td>
</tr>
<tr>
<td>Adresse :</td>
<td><input value="<?php echo $data['adresse']; ?>" name="adresse" type="text"></td>
</tr>
<tr>
<td>Code postal :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['cp'])); ?>" name="cp" type="text"></td>
</tr>
<tr>
<td>Ville :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['ville'])); ?>" name="ville" type="text"></td>
</tr>
<tr>
<td>E-mail :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['email'])); ?>" name="email" type="text"></td>
</tr>
<tr>
<td>Téléphone (fix) :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['tel'])); ?>" name="tel" type="text"></td>
</tr>
<tr>
<td>Téléphone portable :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['tel2'])); ?>" name="tel2" type="text"></td>
</tr>
</table>
</p>
<h1>Votre materiel informatique</h1>
<p><table width="75%" border="0" align="center" cellpadding="20" cellspacing="20">
<tr>
<td width="35%">Type d'ordinateur :</td>
<td width="65%"><input value="<?php echo htmlentities(trim($_SESSION['ordinateur'])); ?>" name="ordinateur" type="text"></td>
</tr>
<tr>
<td>Marque :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['marque'])); ?>" name="marque" type="text"></td>
</tr>
<tr>
<td>Système d'exploitation :</td>
<td><input value="<?php echo htmlentities(trim($_SESSION['os'])); ?>" name="os" type="text"></td>
</tr>
</table>
</p>
<h1>Questionnaire</h1>
<p><table width="75%" border="0" align="center" cellpadding="20" cellspacing="20">
<tr>
<td width="35%" align="right">Experience informatique :</td>
<td width="65%"><input value="<?php echo htmlentities(trim($_SESSION['experience'])); ?>" name="experience" type="text"></td>
</tr>
</table>
</p>
<p><a href="deconnexion.php" class="slider-button">Sauvegarder</a></p>
<p> </p>
</div>
</div>
</div>
<?php include ("footer.php"); ?> |
Je pense que ca vien de là
Code :
1 2
| // lancement de la requete
$sql = 'SELECT * FROM membre WHERE id="'.$_SESSION['id'].'"'; |
Mais je ne voi pas comment faire autrement :s