Précédent   Forum des professionnels en informatique > PHP > Langage
Langage Forum sur le langage PHP, la POO, les conventions, la sécurité, etc. Avant de poster : FAQ Langage, toutes les FAQ PHP, cours langage et sources PHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 16/01/2011, 00h33   #1
Invité de passage
 
Mike
Inscription : janvier 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Mike

Informations forums :
Inscription : janvier 2011
Messages : 3
Points : 1
Points : 1
Par défaut Afficher les infos d'un membre

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
diad.paris est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/01/2011, 01h56   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 101
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 101
Points : 8 466
Points : 8 466
t'as un message qui s'affiche ?
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/01/2011, 22h15   #3
Invité de passage
 
Mike
Inscription : janvier 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Mike

Informations forums :
Inscription : janvier 2011
Messages : 3
Points : 1
Points : 1
C'est bon j'ai enfin réussi !!

Pour ceux qui voudraient faire la meme chose que moi voiçi ce que j'ai fait :

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
<?php include ("header.php"); ?>
<?php
session_start();
if (!isset($_SESSION['login'])) {
	header ('Location: index.php');
	exit();
}
 
$sessionid = $_SESSION['login'];
// on se connecte à notre base
$base = mysql_connect ('127.0.0.1', 'root', '');
mysql_select_db ('diad', $base);
 
$sql = 'SELECT * FROM membre WHERE login="'.$sessionid.'"';
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$data = mysql_fetch_array($req);
?>
<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" cellpadding="20" cellspacing="20">
<tr>
<td width="29%" align="left">Nom d'utilisateur :</td>
<td width="71%"><input value="<?php echo $data['login']; ?>" name="login" type="text"></td>
</tr>
<tr>
<td align="left">Mot de passe :</td>
<td><span style="color:#F00"><input name="login" type="password" disabled value="motdepasse"></span></td>
</tr>
</table></p>
<h1>Informations personnelles</h1>
<table width="75%" border="0" 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 $data['cp']; ?>" name="cp" type="text"></td>
</tr>
<tr>
<td>Ville :</td>
<td><input value="<?php echo $data['ville']; ?>" name="ville" type="text"></td>
</tr>
<tr>
<td>E-mail :</td>
<td><input value="<?php echo $data['email']; ?>" name="email" type="text"></td>
</tr>
<tr>
<td>Téléphone (fix) :</td>
<td><input value="<?php echo $data['tel']; ?>" name="tel" type="text"></td>
</tr>
<tr>
<td>Téléphone portable :</td>
<td><input value="<?php echo $data['tel2']; ?>" name="tel2" type="text"></td>
</tr>
</table>
</p>
<h1>Votre materiel informatique</h1>
<p><table width="75%" border="0" cellpadding="20" cellspacing="20">
<tr>
<td width="35%">Type d'ordinateur :</td>
<td width="65%"><input value="<?php echo $data['ordinateur']; ?>" name="ordinateur" type="text"></td>
</tr>
<tr>
<td>Marque :</td>
<td><input value="<?php echo $data['marque']; ?>" name="marque" type="text"></td>
</tr>
<tr>
<td>Système d'exploitation :</td>
<td><input value="<?php echo $data['os']; ?>" name="os" type="text"></td>
</tr>
</table>
</p>
<h1>Questionnaire</h1>
<p><table width="88%" border="0" cellpadding="20" cellspacing="20">
<tr>
<td width="30%" align="left">Experience informatique :</td>
<td width="70%"><input value="<?php echo $data['experience']; ?>" name="experience" type="text"></td>
</tr>
</table>
</p>
				  <p><a href="#.php" class="slider-button">Sauvegarder</a></p>
<p> </p>
			    </div>
			  </div>
 
			</div>
<?php 
 
// on libère l'espace mémoire alloué pour cette interrogation de la base
mysql_free_result ($req);
mysql_close ();
 
include ("footer.php"); ?>
diad.paris est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/01/2011, 22h18   #4
Invité de passage
 
Mike
Inscription : janvier 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Mike

Informations forums :
Inscription : janvier 2011
Messages : 3
Points : 1
Points : 1
Il me reste à faire un système de modification et le tour est joué
diad.paris est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h45.


 
 
 
 
Partenaires

Hébergement Web