IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Afficher les infos d'un membre


Sujet :

Langage PHP

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Points : 2
    Points
    2
    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 : 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
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    // lancement de la requete
    $sql = 'SELECT * FROM membre WHERE id="'.$_SESSION['id'].'"';
    Mais je ne voi pas comment faire autrement :s

  2. #2
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 726
    Points
    10 726
    Par défaut
    t'as un message qui s'affiche ?

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Points : 2
    Points
    2
    Par défaut
    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 : 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
    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"); ?>

  4. #4
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Points : 2
    Points
    2
    Par défaut
    Il me reste à faire un système de modification et le tour est joué

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Afficher au clic les infos sur un membre
    Par johanna1 dans le forum Langage
    Réponses: 8
    Dernier message: 23/05/2015, 17h00
  2. Comment afficher les infos en mode debug ?
    Par jppaysan dans le forum Qt
    Réponses: 4
    Dernier message: 28/05/2008, 01h24
  3. Aide pour afficher les infos
    Par john7911 dans le forum Langage
    Réponses: 5
    Dernier message: 13/03/2008, 15h52
  4. Réponses: 1
    Dernier message: 01/09/2006, 12h02
  5. Tutoriel Afficher les infos d'une base de données
    Par dolf13 dans le forum Langage
    Réponses: 2
    Dernier message: 14/06/2006, 11h56

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo