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

PHP & Base de données Discussion :

sélectionner un nom dans une liste déroulante et afficher le résultat dans un tableau [MySQL]


Sujet :

PHP & Base de données

  1. #1
    Membre du Club
    Femme Profil pro
    piano
    Inscrit en
    Décembre 2011
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Suisse

    Informations professionnelles :
    Activité : piano
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Décembre 2011
    Messages : 131
    Points : 65
    Points
    65
    Par défaut sélectionner un nom dans une liste déroulante et afficher le résultat dans un tableau
    Bonjour,
    J'essaie désespérément de sélectionner un nom dans une liste déroulante et afficher les données liées sélectionnées dans un tableau. L'id du nom sélectionné est bien récupéré dans le formulaire, mais au lieu d'afficher uniquement les données sélectionnées, mon tableau affiche tout, cela fait plusieurs jours (et nuits !!) que je cherche mais je ne trouve pas où est l'erreur. Voici le code de mes deux formulaires :

    Formulaire avec la liste déroulante :

    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
     
     
    <?php
    include("include/variables.inc.php");
    include("menu.php");
    // Connexion à MySQL
    $liendb = mysql_connect($bddserver, $bddlogin, $bddpassword);
    mysql_select_db($bdd);
     
    //creation de la requete et excécution de la requete
    //**************************************
    $query = "SELECT * FROM locataires 
    WHERE  reserve = 'oui'
    ORDER BY nom";
     
    $result = mysql_query($query);
     
    $result = mysql_query($query) or die (mysql_error());
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Choix du locataire</title>
    </head>
     
    <body>
    <form action="testliste001.php" method="GET">
    <p>Choisissez un nom : <select name="truc">
    <?php
    while($line = mysql_fetch_assoc($result)){
     
        echo '<option value="'.$line['idnoms'].'">'.$line['nom']."&nbsp;&nbsp;-&nbsp;&nbsp;" .$line['prenom'].'</option>';
        }
    ?>
    </select>
    </p>
    <p><input type="submit" value="Voir les infos"  /></p>
    </form>
    </body>
    </html>

    Et le formulaire avec le tableau qui devrait afficher uniquement les données liées :

    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
     
     
    <style type="text/css">
    .alindr 
    {text-align: right;}
    </style>
    <?php
    include("menu.php");
    //reception de la variable
    $id = isset($_GET['truc']) ? $_GET['truc'] : '';
    //affichage de la variable pour vérifier qu'elle est reçue
        echo "<BR>$id<BR><BR>\n";
     
    function display($string)
    {
        echo htmlentities($string, ENT_QUOTES, 'ISO-8859-1');
    }
     
    include("include/variables.inc.php");
    	$liendb  =  mysql_connect($bddserver,  $bddlogin,  $bddpassword);
    mysql_select_db  ($bdd);
     
    $sql = "SELECT DATE_FORMAT( datearrive, '%d/%m/%Y' ) AS datea, DATE_FORMAT( datearrive, '%Y' ) AS annee, DATE_FORMAT( datedepart, '%d/%m/%Y' ) AS dated, DATEDIFF(datedepart,datearrive ) AS datediff, dateloca.datearrive, dateloca.datedepart, dateloca.nombre, dateloca.prixlocation, dateloca.caution, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby) as PT, (dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement) as Totalpaye, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.1erpaiement-dateloca.2epaiement-dateloca.3epaiement) as Reste, (dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement-dateloca.caution) as Totalrevenu, dateloca.1erpaiement, DATE_FORMAT( date1erpaiement, '%d/%m/%Y' ) AS dateunp, dateloca.2epaiement, DATE_FORMAT( date2epaiement, '%d/%m/%Y' ) AS datedeuxp, dateloca.3epaiement, DATE_FORMAT( date3epaiement, '%d/%m/%Y' ) AS datetroisp, dateloca.linge, dateloca.litbaby, dateloca.degatspayes, dateloca.nonpaye, dateloca.remarques, dateloca.restitution, DATE_FORMAT( datelettre, '%d/%m/%Y' ) AS datel, dateloca.appart, dateloca.envoitarifs, dateloca.envoidescriptif, dateloca.paragraphesup, dateloca.confirmation, dateloca.enfants, locataires.nom, locataires.prenom, locataires.idnoms
    				FROM dateloca
    INNER JOIN locataires ON  dateloca.idnoms = locataires.idnoms
    				WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0
    				ORDER BY locataires.nom, datearrive desc;";
     
    $result = mysql_query($sql);
     
    if($result)
    {
    ?>
        <table border="1">
            <tr>
                <th>id</th>
                <th>Arrivée</th>
                <th>Départ</th>
    	    <th>Nb. jours</th>
    	    <th>Nom et prénom</th>
                <th>Prix Location</th>
                <th>Caution</th>
                <th>Lit bébé</th>
                <th>Linge</th>
                <th>Prix Total</th>																		
    	    <th>Somme payée</th>
                <th>Reste à payer</th>
    	    <th>Degâts payés</th>
    	    <th>Non payé</th>
    	    <th>Revenu</th>
    	    <th>Caution restituée</th>
    	</tr>
    <?php
            while($dateloca = mysql_fetch_assoc($result))
    {
    ?>
                <tr>
                    <td><?php display($dateloca['idnoms']); ?></td>
                    <td><?php display($dateloca['datea']); ?></td>
                    <td><?php display($dateloca['dated']); ?></td>								
                    <td><div class="alindr"><?php display($dateloca['datediff']); ?></div></td>								
                    <td><?php display($dateloca['nom'] . ' - ' .  $dateloca['prenom']); ?></td>
                    <td><div class="alindr"><?php display($dateloca['prixlocation']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['caution']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['litbaby']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['linge']); ?></div></td>																								
                    <td><div class="alindr"><?php display($dateloca['PT']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['Totalpaye']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['Reste']); ?></div></td>																																								
                    <td><div class="alindr"><?php display($dateloca['degatspayes']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['nonpaye']); ?></div></td>
                    <td><div class="alindr"><?php 
    								if ($dateloca['restitution'] == 'non') 0; else
    								display($dateloca['Totalrevenu']); ?></div></td>								
                    <td><div class="alindr"><?php display($dateloca['restitution']); ?></div></td>								
     
    <?php
     
    }
    ?>
     
        </table>
    <br />
    <br />
    <br />
    <br />
    <?php
    }
    mysql_close($liendb);
    ?>
    D'avance merci pour votre aide

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    $sql = "SELECT ...................................
    	WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0
    	ORDER BY locataires.nom, datearrive desc;";
    Il faudrait penser à intégrer le $id dans la requête !

    N.B. Passe ton formulaire en method="post", et récupère les variables avec $_POST.
    Ca évite de les afficher dans l'URL (où elles sont trop facilement modifiables).
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    //reception de la variable
    $id = isset($_POST['truc']) ? $_POST['truc'] : '';
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    // ON PROTEGE la requête contre les injections SQL :
    $id = mysql_real_escape_string($id) ; // IMPORTANT !!!
     
    $sql = "SELECT ...................................
    	WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0
    	AND locataires.idnoms = " . $id . "
    	ORDER BY locataires.nom, datearrive desc;";

  3. #3
    Membre du Club
    Femme Profil pro
    piano
    Inscrit en
    Décembre 2011
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Suisse

    Informations professionnelles :
    Activité : piano
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Décembre 2011
    Messages : 131
    Points : 65
    Points
    65
    Par défaut
    Merci beaucoup pour m'avoir répondu aussi rapidement, malheureusement, maintenant il n'y a plus rien qui s'affiche mais au moins c'est mieux sécurisé

    Je suis perplexe, j'ai essayé en faisant les modifications les unes après les autres et aussi dans l'autre sens mais cela ne donne rien.

    D'avance merci si vous avez la suite de la solution

  4. #4
    Invité
    Invité(e)
    Par défaut
    Redonne ton code à chaque fois.

    1/ Pour afficher les message d'erreur en PHASE DE TEST, mets en haut de page :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php error_reporting ( E_ALL ); ?>
    2/ As-tu bien mis le formulaire en post ?
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    <form method="post"...>
    As-tu vérifié que $id existe bien en l'AFFICHANT
    As-tu affiché la requête ?
    Bref : le B.A.BA du débogage et d'AFFICHER les variables/requêtes pour vérifier ce qu'elles contiennent.

  5. #5
    Membre du Club
    Femme Profil pro
    piano
    Inscrit en
    Décembre 2011
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Suisse

    Informations professionnelles :
    Activité : piano
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Décembre 2011
    Messages : 131
    Points : 65
    Points
    65
    Par défaut
    Merci beaucoup, j'ai fait les modifications demandées, la requête s'affiche avec l'id correct
    et l'id s'affiche aussi en haut de la page, par contre mon tableau est toujours désespérément vide

    Comme demandé, voici de nouveau mon code (corrigé):

    La liste déroulante:
    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
     
    <?php error_reporting ( E_ALL ); ?>
    <?php
    include("include/variables.inc.php");
    include("menu.php");
    // Connexion à MySQL
    $liendb = mysql_connect($bddserver, $bddlogin, $bddpassword);
    mysql_select_db($bdd);
     
    //creation de la requete et excécution de la requete
    //**************************************
    $query = "SELECT * FROM locataires 
    WHERE  reserve = 'oui'
    ORDER BY nom";
     
    $result = mysql_query($query);
     
    $result = mysql_query($query) or die (mysql_error());
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Choix du locataire</title>
    </head>
     
    <body>
    <form action="testliste001.php" method="POST">
    <p>Choisissez un nom : <select name="truc">
    <?php
    while($line = mysql_fetch_assoc($result)){
     
        echo '<option value="'.$line['idnoms'].'">'.$line['nom']."&nbsp;&nbsp;-&nbsp;&nbsp;" .$line['prenom'].'</option>';
        }
    ?>
    </select>
    </p>
    <p><input type="submit" value="Voir les infos"  /></p>
    </form>
    </body>
    </html>
    Le formulaire avec le tableau devant afficher le résultat de la liste déroulante:

    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
     
     
    <?php error_reporting ( E_ALL ); ?>
    <?php
    include("menu.php");
    //reception de la variable
    $id = isset($_POST['truc']) ? $_POST['truc'] : '';
    $id = mysql_real_escape_string($id) ; // IMPORTANT !!!
    //affichage de la variable pour vérifier qu'elle est reçue
    $id = $_POST['truc'];
    echo $id;
     
    ?>
    <br >
    <br >
    <br >
    <br >
    <?php
     
    function display($string)
    {
        echo htmlentities($string, ENT_QUOTES, 'ISO-8859-1');
    }
     
    include("include/variables.inc.php");
    	$liendb  =  mysql_connect($bddserver,  $bddlogin,  $bddpassword);
    mysql_select_db  ($bdd);
     
    $sql = "SELECT DATE_FORMAT( datearrive, '%d/%m/%Y' ) AS datea, DATE_FORMAT( datearrive, '%Y' ) AS annee, DATE_FORMAT( datedepart, '%d/%m/%Y' ) AS dated, DATEDIFF(datedepart,datearrive ) AS datediff, dateloca.datearrive, dateloca.datedepart, dateloca.nombre, dateloca.prixlocation, dateloca.caution, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby) as PT, (dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement) as Totalpaye, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.1erpaiement-dateloca.2epaiement-dateloca.3epaiement) as Reste, (dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement-dateloca.caution) as Totalrevenu, dateloca.1erpaiement, DATE_FORMAT( date1erpaiement, '%d/%m/%Y' ) AS dateunp, dateloca.2epaiement, DATE_FORMAT( date2epaiement, '%d/%m/%Y' ) AS datedeuxp, dateloca.3epaiement, DATE_FORMAT( date3epaiement, '%d/%m/%Y' ) AS datetroisp, dateloca.linge, dateloca.litbaby, dateloca.degatspayes, dateloca.nonpaye, dateloca.remarques, dateloca.restitution, DATE_FORMAT( datelettre, '%d/%m/%Y' ) AS datel, dateloca.appart, dateloca.envoitarifs, dateloca.envoidescriptif, dateloca.paragraphesup, dateloca.confirmation, dateloca.enfants, locataires.nom, locataires.prenom, locataires.idnoms
    				FROM dateloca
    INNER JOIN locataires ON  dateloca.idnoms = locataires.idnoms
    
    WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0 	AND locataires.idnoms = ' . $id . '
    	ORDER BY locataires.nom, datearrive desc;";
     
    echo $sql;
     
    $result = mysql_query($sql);
     
    if($result)
    {
    ?>
        <table border="1">
            <tr>
                <th>id</th>
                <th>Arrivée</th>
                <th>Départ</th>
    	    <th>Nb. jours</th>
    	    <th>Nom et prénom</th>
                <th>Prix Location</th>
                <th>Caution</th>
                <th>Lit bébé</th>
                <th>Linge</th>
                <th>Prix Total</th>																		
    	    <th>Somme payée</th>
                <th>Reste à payer</th>
    	    <th>Degâts payés</th>
    	    <th>Non payé</th>
    	    <th>Revenu</th>
    	    <th>Caution restituée</th>
    	</tr>
    <?php
            while($dateloca = mysql_fetch_assoc($result))
    {
    ?>
                <tr>
                    <td><?php display($dateloca['idnoms']); ?></td>
                    <td><?php display($dateloca['datea']); ?></td>
                    <td><?php display($dateloca['dated']); ?></td>								
                    <td><div class="alindr"><?php display($dateloca['datediff']); ?></div></td>								
                    <td><?php display($dateloca['nom'] . ' - ' .  $dateloca['prenom']); ?></td>
                    <td><div class="alindr"><?php display($dateloca['prixlocation']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['caution']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['litbaby']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['linge']); ?></div></td>																								
                    <td><div class="alindr"><?php display($dateloca['PT']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['Totalpaye']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['Reste']); ?></div></td>																																								
                    <td><div class="alindr"><?php display($dateloca['degatspayes']); ?></div></td>
                    <td><div class="alindr"><?php display($dateloca['nonpaye']); ?></div></td>
                    <td><div class="alindr"><?php 
    								if ($dateloca['restitution'] == 'non') 0; else
    								display($dateloca['Totalrevenu']); ?></div></td>								
                    <td><div class="alindr"><?php display($dateloca['restitution']); ?></div></td>								
     
    <?php
     
    }
    ?>
     
        </table>
    <br />
    <br />
    <br />
    <br />
    <?php
    }
    mysql_close($liendb);
    ?>
    Malgré le

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php error_reporting ( E_ALL ); ?>
    Aucune erreur ne s'affiche, c'est étrange, car il doit bien y en avoir une quelque part ??? Je n'y comprends plus rien!!!

    D'avance un tout grand merci pour votre aide si précieuse et votre patience. Bon week-end

  6. #6
    Membre du Club
    Femme Profil pro
    piano
    Inscrit en
    Décembre 2011
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Suisse

    Informations professionnelles :
    Activité : piano
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Décembre 2011
    Messages : 131
    Points : 65
    Points
    65
    Par défaut


    ça fonctionne !!!


    Voici ce que j'ai changé, avant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    $sql = "SELECT..... locataires.idnoms
    FROM dateloca
    INNER JOIN locataires ON  dateloca.idnoms = locataires.idnoms
    WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0 AND locataires.idnoms = '$id'
    ORDER BY locataires.nom, datearrive desc;";
    Maintenant:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    $sql = "SELECT....... locataires.idnoms AS '.$id.'
    	FROM dateloca
            INNER JOIN locataires ON  dateloca.idnoms = locataires.idnoms
    	WHERE locataires.reserve = 'oui' AND dateloca.annul =2 AND dateloca.prixlocation >0 AND locataires.idnoms = '$id'
    	ORDER BY locataires.nom, datearrive desc;";

    C'était tout bête, il falait ajouter dans le select : " locataires.idnoms AS '.$id.' "

    Je vais enfin pouvoir dormir sans réfléchir toute la nuit

    Un tout grand merci pour votre aide et un excellent week-end

  7. #7
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par notebleue Voir le message
    ça fonctionne !!!
    Ca m'étonne, car... FAUX.

    Il fallait surtout mettre des " :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    $sql = "SELECT 
    	...........
    	AND locataires.idnoms = '" . $id . "'
    	...........";
    On peut écrire ici aussi (j'aime moins, car on perd la coloration syntaxique, et on peut faire des erreurs) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    $sql = "SELECT 
    	...........
    	AND locataires.idnoms = '$id'
    	...........";
    La requête, écrite "proprement" (= de façon lisible) :
    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
    $sql = "SELECT 
    		DATE_FORMAT( datearrive, '%d/%m/%Y' ) AS datea, 
    		DATE_FORMAT( datearrive, '%Y' ) AS annee, 
    		DATE_FORMAT( datedepart, '%d/%m/%Y' ) AS dated, 
    		DATEDIFF(datedepart,datearrive ) AS datediff, 
    		dateloca.datearrive, 
    		dateloca.datedepart, 
    		dateloca.nombre, 
    		dateloca.prixlocation, 
    		dateloca.caution, 
    		(dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby) as PT, 
    		(dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement) as Totalpaye, 
    		(dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.1erpaiement-dateloca.2epaiement-dateloca.3epaiement) as Reste, 
    		(dateloca.1erpaiement+dateloca.2epaiement+dateloca.3epaiement-dateloca.caution) as Totalrevenu, 
    		dateloca.1erpaiement, DATE_FORMAT( date1erpaiement, '%d/%m/%Y' ) AS dateunp, 
    		dateloca.2epaiement, 
    		DATE_FORMAT( date2epaiement, '%d/%m/%Y' ) AS datedeuxp, dateloca.3epaiement, 
    		DATE_FORMAT( date3epaiement, '%d/%m/%Y' ) AS datetroisp, 
    		dateloca.linge, 
    		dateloca.litbaby, 
    		dateloca.degatspayes, 
    		dateloca.nonpaye, 
    		dateloca.remarques, 
    		dateloca.restitution, 
    		DATE_FORMAT( datelettre, '%d/%m/%Y' ) AS datel, 
    		dateloca.appart, 
    		dateloca.envoitarifs, 
    		dateloca.envoidescriptif, 
    		dateloca.paragraphesup, 
    		dateloca.confirmation, 
    		dateloca.enfants, 
    		locataires.nom, 
    		locataires.prenom, 
    		locataires.idnoms
    	FROM dateloca
    	INNER JOIN locataires 
    		ON dateloca.idnoms = locataires.idnoms
     
    	WHERE locataires.reserve = 'oui' 
    	AND dateloca.annul =2 
    	AND dateloca.prixlocation >0
    	AND locataires.idnoms = '" . $id . "'
    	ORDER BY locataires.nom, datearrive desc;";
    Dernière modification par Invité ; 06/03/2015 à 23h40.

  8. #8
    Membre du Club
    Femme Profil pro
    piano
    Inscrit en
    Décembre 2011
    Messages
    131
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Suisse

    Informations professionnelles :
    Activité : piano
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Décembre 2011
    Messages : 131
    Points : 65
    Points
    65
    Par défaut
    Merci d'avoir pris la peine de corriger mon code alors que j'avais marqué la discussion comme résolue.
    J'ai tenu compte de ta remarque et corrigé mon code, effectivement c'est beaucoup plus lisible comme cela et ça fonctionne!!!

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

Discussions similaires

  1. Réponses: 3
    Dernier message: 14/05/2014, 12h00
  2. Réponses: 6
    Dernier message: 09/05/2014, 17h23
  3. Afficher des informations dans une liste déroulante
    Par onlytime dans le forum Langage
    Réponses: 1
    Dernier message: 08/03/2008, 18h47
  4. Réponses: 8
    Dernier message: 17/10/2007, 18h37
  5. Remplir une liste déroulante à partir d'un champ dans une pop up
    Par wiam26 dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 23/08/2006, 16h42

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