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 :

Erreur d'affichage d'un listing php dans un html [MySQL]


Sujet :

PHP & Base de données

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    329
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 329
    Points : 126
    Points
    126
    Par défaut Erreur d'affichage d'un listing php dans un html
    Bonsoir

    J ai une erreur d'affichage des données. Je l'ai marqué elle est entre des étoiles. J'ai tenté de résoudre avec des " " de ' ' ou avec des { } rien à faire

    Voici le message d'erreur
    Parse error: parse error, expecting `','' or `';'' in c:\program files\easyphp1-8\www\tentative\fr\particulier\p_d\voir\essai.php on line 123
    le code :

    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
     
    <? session_start(); ?>
    <?
          mysql_connect("localhost","root","");
          mysql_select_db("essai");
    $cat = 23;
    //$cat = $_POST['menu_3'];
    $ver = mysql_query("SELECT num_menu FROM fr_calcul_qte_pr_variant WHERE num_menu = $cat");
    $a = mysql_result($ver,'num_menu');
    $select = "SELECT a.num_demande,a.num_menu,a.temps_restant,a.prix_souhaite,a.titre,a.photo,c.num_demande,c.quantite_totale,c.prix_variant FROM fr_calcul_qte_pr_variant c,fr_part_demande a WHERE a.num_menu = $a AND a.num_demande = c.num_demande";
    $res = mysql_query($select);
    ?>
    <html>
    <head>
    </head>
    <BODY>
    <table bgcolor="#000000" border="1" align="Left">
    <tr>
       <th colspan=6 align=center bgcolor="#FFFFFF"><b>Le Listing</b></th>
    </tr>
    <tr>
       <td align="center" bgcolor="#669999" ><b>Photo</b></td>
       <td align="center" bgcolor="#669999"><b>Titre</b></td>
       <td align="center" bgcolor="#669999"><b>Prix Souhaité</b></td>
       <td align="center" bgcolor="#669999"><b>Quantite Totale</b></td>
       <td align="center" bgcolor="#669999"><b>Prix Variant</b></td>
       <td align="center" bgcolor="#669999"><b>Temps Restant</b></td>
    </tr>  
    <? while($row = mysql_fetch_array($res)) ?> 
    <tr>
    <? //*********************erreur****************************// ?>
    <td bgcolor="#FFFFFF"><b><? echo .$row["photo"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["titre"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_souhaite"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["quantite_totale"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_variant"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["temps_restant"].; ?></b></td>
    <? //*********************erreur******************************$// ?>
    </tr>
    </table>
    </BODY>
    </html>

  2. #2
    Membre confirmé Avatar de amika
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    498
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Septembre 2004
    Messages : 498
    Points : 464
    Points
    464
    Par défaut
    ajoute des {}
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <? while($row = mysql_fetch_array($res)) { ?>
    <tr>
    <td bgcolor="#FFFFFF"><b><? echo .$row["photo"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["titre"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_souhaite"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["quantite_totale"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_variant"].; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo .$row["temps_restant"].; ?></b></td>
    <?} ?>

  3. #3
    Membre éprouvé
    Inscrit en
    Juillet 2004
    Messages
    1 027
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 1 027
    Points : 1 164
    Points
    1 164
    Par défaut
    Salut carmen,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <td bgcolor="#FFFFFF"><b><? echo .$row["photo"].; ?></b></td> 
    <td bgcolor="#FFFFFF"><b><? echo .$row["titre"].; ?></b></td> 
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_souhaite"].; ?></b></td> 
    <td bgcolor="#FFFFFF"><b><? echo .$row["quantite_totale"].; ?></b></td> 
    <td bgcolor="#FFFFFF"><b><? echo .$row["prix_variant"].; ?></b></td> 
    <td bgcolor="#FFFFFF"><b><? echo .$row["temps_restant"].; ?></b></td>
    Ce qui plante ici ce sont les points. En effet ils sont normalement utilisé pour faire de la concaténation.
    Comme cela :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo $toto." voila du texte dur ".$tata;
    Et non pas comme tu semble l'avoir fait, qui ne correspond à rien de connu

    Donc voila ce que cela devrait être pour le premier, pour les autres tu le feras hein
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <td bgcolor="#FFFFFF"><b><? echo $row["photo"]; ?></b></td>
    bye

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    329
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 329
    Points : 126
    Points
    126
    Par défaut rep
    sans les . ca marche mais j ai aucune lignes qui s'affichent c'est bizarre.
    avec les point j ai le message d'erreur précédent

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    <? while($row = mysql_fetch_array($res)) { ?> 
    <tr>
    <td bgcolor="#FFFFFF"><b><? echo $row["photo"]; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo $row["titre"]; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo $row["prix_souhaite"]; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo $row["quantite_totale"]; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo $row["prix_variant"]; ?></b></td>
    <td bgcolor="#FFFFFF"><b><? echo $row["temps_restant"]; ?></b></td>
    <? } ?>
    </tr>

  5. #5
    Membre éprouvé
    Inscrit en
    Juillet 2004
    Messages
    1 027
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 1 027
    Points : 1 164
    Points
    1 164
    Par défaut
    Si rien ne s'affiche sa vient de par ici ->

    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
    $select = "
    SELECT 
         a.num_demande, 
         a.num_menu, 
         a.temps_restant, 
         a.prix_souhaite, 
         a.titre, 
         a.photo, 
         c.num_demande, 
         c.quantite_totale, 
         c.prix_variant 
    FROM 
         fr_calcul_qte_pr_variant c,
         fr_part_demande a 
    WHERE 
         a.num_menu = $a 
    AND 
         a.num_demande = c.num_demande
    ";
    Mais je ne voit pas comment t'aider, tu ne donnes pas assez d'infos.

    bye

  6. #6
    Membre confirmé Avatar de amika
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    498
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Septembre 2004
    Messages : 498
    Points : 464
    Points
    464
    Par défaut
    essayer d'afficher le nombre de lignes retournés par ta requette peut etre qu'elle ne retourne rien
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $nb=mysql_num_rows($res);
    echo $nb;

  7. #7
    Membre habitué
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    329
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 329
    Points : 126
    Points
    126
    Par défaut
    Voici un code qui fonctionne en php que j 'ai fait . Il est exclusivement en php . C'est le meme mais je voudrai l'intégre intégré du html pour m'eviter de taper pour toutes les lignes html ca :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
          echo '<th colspan=6 align=center bgcolor="#FFFFFF"><b>Le Listing</b></th>';
    alors que c'est plus simple d'ecrire du html et d'inserer juste le php ou on veut qu il affiche la donnée.

    exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <tr>
     <td><b>Nom :</b></td>
     <td align="left"><b><? echo $donnees["nom"]; ?></b></td>
    </tr>
    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
     
    <? session_start() ?>
    <?
    $db = mysql_connect("localhost","root","");
          mysql_select_db("essai");
    $cat = 23;
    //$cat = $_POST['menu_3'];
    $ver = mysql_query("SELECT num_menu FROM fr_calcul_qte_pr_variant WHERE num_menu = $cat");
    $a = mysql_result($ver,'num_menu');
    $select = "SELECT a.num_demande,a.num_menu,a.temps_restant,a.prix_souhaite,a.titre,a.photo,c.num_demande,c.quantite_totale,c.prix_variant FROM fr_calcul_qte_pr_variant c,fr_part_demande a WHERE a.num_menu = $a AND a.num_demande = c.num_demande";
    $res = mysql_query($select);
          echo '<table bgcolor="#000000" border="1" align="center">'."\n";
          echo '<tr>';
          echo '<th colspan=6 align=center bgcolor="#FFFFFF"><b>Le Listing</b></th>';
          echo '</tr>';
          echo '<tr>';
    	  echo '<td align="center" bgcolor="#669999" ><b>Photo</b></td>';
          echo '<td align="center" bgcolor="#669999"><b>Titre</b></td>';
          echo '<td align="center" bgcolor="#669999"><b>Prix Souhaité</b></td>';
          echo '<td align="center" bgcolor="#669999"><b>Quantite Totale</b></td>';
          echo '<td align="center" bgcolor="#669999"><b>Prix Variant</b></td>';
    	  echo '<td align="center" bgcolor="#669999"><b>Temps Restant</b></td>';
          echo '</tr>'."\n";   
          while($row = mysql_fetch_array($res))
          { echo '<tr>';
    	  echo '<td bgcolor="#FFFFFF"><b>'.$row["photo"].'</b></td>';
          echo '<td bgcolor="#FFFFFF"><b>'.$row["titre"].'</b></td>';
          echo '<td bgcolor="#FFFFFF"><b>'.$row["prix_souhaite"].'</b</td>';
          echo '<td bgcolor="#FFFFFF"><b>'.$row["quantite_totale"].'</b></td>';
          echo '<td bgcolor="#FFFFFF"><b>'.$row["prix_variant"].'</b></td>';
    	  echo '<td bgcolor="#FFFFFF"><b>'.$row["temps_restant"].'</b></td>';
          echo '</tr>'."\n"; }
          echo '</table>'."\n";
    ?>

  8. #8
    Membre habitué
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    329
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 329
    Points : 126
    Points
    126
    Par défaut rep
    le dernier fonctionne

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

Discussions similaires

  1. [XL-2007] Erreur d'affichage d'une liste déroulante
    Par jeanjean6 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 15/07/2013, 15h36
  2. Erreur d'index sur une List<int> dans boucle for
    Par popoliline dans le forum C#
    Réponses: 13
    Dernier message: 16/06/2010, 11h03
  3. Réponses: 2
    Dernier message: 08/09/2008, 15h14
  4. Affichage d'une liste double dans un tableau
    Par G3G3 dans le forum Tkinter
    Réponses: 2
    Dernier message: 08/07/2008, 10h32
  5. affichage dynamique de variable php dans javascript
    Par Revan dans le forum Langage
    Réponses: 6
    Dernier message: 11/05/2008, 13h25

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