MySql Problème d' affichage
qmike
Messages postés
1599
Date d'inscription
Statut
Membre
Dernière intervention
-
qmike Messages postés 1599 Date d'inscription Statut Membre Dernière intervention -
qmike Messages postés 1599 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai le script suivant
<?php
mysql_connect("localhost", "xxxx", "xxxxxx"); // Connexion à MySQL
mysql_select_db("BaseIncident"); // Sélection de la base coursphp
$reponse = mysql_query("SELECT * FROM Incidents where Cloturer='0' order by Application DESC"); // Requête SQL
// On fait une boucle pour lister tout ce que contient la table :
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<table border=1 align=center width=75%>
<TH bgcolor="#66FFCC"> Date demande </TH>
<TH bgcolor="#66FFCC"> Application </TH>
<TH bgcolor="#66FFCC"> N° HELPDESK </TH>
<TH bgcolor="#66FFCC"> Objet de la Demande </TH>
<TH bgcolor="#66FFCC"> Commentaire </TH>
<TH bgcolor="#66FFCC"> STATUT </TH>
<tr>
<td align=center width="15"><?php echo $donnees['DateDemande'] ?>
<td width="30" align=center><?php echo $donnees['Application'] ?>
<td width="20" ><?php echo $donnees['NumSHS'] ?>
<td width="100"><?php echo $donnees['Objet'] ?>
<td width="100"><?php echo $donnees['Commentaire'] ?>
<td width="8" align=center <font color="red"><?php echo $donnees['Cloturer'] ?> </font>
<br>
</table>
<?php
}
mysql_close(); // Déconnexion de MySQL
?>
Question 1 : Comment faire pour l' en-tête du tableau ne soit pas reprise pour chaque ligne trouvée dans la base
Question 2 : La date s'affiche au format américain
Comment faire pour que cette date s'affiche au format francais
Merci pour vos réponses
j'ai le script suivant
<?php
mysql_connect("localhost", "xxxx", "xxxxxx"); // Connexion à MySQL
mysql_select_db("BaseIncident"); // Sélection de la base coursphp
$reponse = mysql_query("SELECT * FROM Incidents where Cloturer='0' order by Application DESC"); // Requête SQL
// On fait une boucle pour lister tout ce que contient la table :
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<table border=1 align=center width=75%>
<TH bgcolor="#66FFCC"> Date demande </TH>
<TH bgcolor="#66FFCC"> Application </TH>
<TH bgcolor="#66FFCC"> N° HELPDESK </TH>
<TH bgcolor="#66FFCC"> Objet de la Demande </TH>
<TH bgcolor="#66FFCC"> Commentaire </TH>
<TH bgcolor="#66FFCC"> STATUT </TH>
<tr>
<td align=center width="15"><?php echo $donnees['DateDemande'] ?>
<td width="30" align=center><?php echo $donnees['Application'] ?>
<td width="20" ><?php echo $donnees['NumSHS'] ?>
<td width="100"><?php echo $donnees['Objet'] ?>
<td width="100"><?php echo $donnees['Commentaire'] ?>
<td width="8" align=center <font color="red"><?php echo $donnees['Cloturer'] ?> </font>
<br>
</table>
<?php
}
mysql_close(); // Déconnexion de MySQL
?>
Question 1 : Comment faire pour l' en-tête du tableau ne soit pas reprise pour chaque ligne trouvée dans la base
Question 2 : La date s'affiche au format américain
Comment faire pour que cette date s'affiche au format francais
Merci pour vos réponses
Configuration: Windows XP Firefox 3.0.11
15 réponses
-
Bonjour,
Question 1 : Ben suffit de déclarer l'entête avant le début du while ^^
Question 2 : http://www.graphiks.net/cours/php/18-date-et-heure-au-format-francais.html -
Bonjour,
Pour ne pas répéter l'en-tete, il ne faut pas mettre<table border=1 align=center width=75%> <TH bgcolor="#66FFCC"> Date demande </TH> <TH bgcolor="#66FFCC"> Application </TH> <TH bgcolor="#66FFCC"> N° HELPDESK </TH> <TH bgcolor="#66FFCC"> Objet de la Demande </TH> <TH bgcolor="#66FFCC"> Commentaire </TH> <TH bgcolor="#66FFCC"> STATUT </TH> et </table>
Dans ton while sinon c'est tout le tableau que tu répètes a chaque fois -
oui ca ok
mais dans ce cas,, comment récupérer l'en tete du tableau -
echo "En tete du tableau"; While(...){ echo <tr>....</tr> } echo "</table>"; -
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
non cela ne fonctionne pas
echo <TH bgcolor="#66FFCC"> Date demande </TH>
echo <TH bgcolor="#66FFCC"> Application </TH>
echo <TH bgcolor="#66FFCC"> N° HELPDESK </TH> -
Ben oui pas étonnant ^^
echo '<TH bgcolor="#66FFCC"> Date demande </TH><TH bgcolor="#66FFCC"> Application </TH><TH bgcolor="#66FFCC"> N° HELPDESK </TH>'; -
<?php mysql_connect("localhost", "xxxx", "xxxxxx"); // Connexion à MySQL mysql_select_db("BaseIncident"); // Sélection de la base coursphp $reponse = mysql_query("SELECT * FROM Incidents where Cloturer='0' order by Application DESC"); // Requête SQL // On fait une boucle pour lister tout ce que contient la table : ?> <table border=1 align=center width=75%> <TH bgcolor="#66FFCC"> Date demande </TH> <TH bgcolor="#66FFCC"> Application </TH> <TH bgcolor="#66FFCC"> N° HELPDESK </TH> <TH bgcolor="#66FFCC"> Objet de la Demande </TH> <TH bgcolor="#66FFCC"> Commentaire </TH> <TH bgcolor="#66FFCC"> STATUT </TH> <?php while ($donnees = mysql_fetch_array($reponse) ) { ?> <tr> <td align=center width="15"><?php echo $donnees['DateDemande'] ?></td> <td width="30" align=center><?php echo $donnees['Application'] ?></td> <td width="20" ><?php echo $donnees['NumSHS'] ?></td> <td width="100"><?php echo $donnees['Objet'] ?></td> <td width="100"><?php echo $donnees['Commentaire'] ?></td> <td width="8" align=center <font color="red"><?php echo $donnees['Cloturer'] ?> </font></td> <tr> <?php } ?> </table> <?php } mysql_close(); // Déconnexion de MySQL ?> -
merci pour ta réponse
Hélas, dans ce cas, seul le premier enregistrement trouvé est inclus dans le tableau
les autres enregistrement sont hors tableau -
Oui c'est l'entête de ton tableau qui était fausse :
<table border=1 align=center width=75%>
<TR>
<TH bgcolor="#66FFCC"> Date demande </TH>
<TH bgcolor="#66FFCC"> Application </TH>
<TH bgcolor="#66FFCC"> N° HELPDESK </TH>
<TH bgcolor="#66FFCC"> Objet de la Demande </TH>
<TH bgcolor="#66FFCC"> Commentaire </TH>
<TH bgcolor="#66FFCC"> STATUT </TH>
</TR> -
comment ca ???
-
Il faut rajouter les <TR> et </TR>
-
Non désolé , le problème est identique
<?php
mysql_connect("localhost", "xxxx", "xxxx"); // Connexion à MySQL
mysql_select_db("BaseIncident"); // Sélection de la base coursphp
$reponse = mysql_query("SELECT * FROM Incidents where Cloturer='0' order by Application DESC"); // Requête SQL
// On fait une boucle pour lister tout ce que contient la table :
?>
<table border=1 align=center width=75%>
<tr>
<TH bgcolor="#66FFCC"> Date demande </TH>
<TH bgcolor="#66FFCC"> Application </TH>
<TH bgcolor="#66FFCC"> N° HELPDESK </TH>
<TH bgcolor="#66FFCC"> Objet de la Demande </TH>
<TH bgcolor="#66FFCC"> Commentaire </TH>
<TH bgcolor="#66FFCC"> STATUT </TH>
</tr>
<?php
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<tr>
<td align=center width="5"><?php echo $donnees['DateDemande'] ?>
<td width="30" align=center><?php echo $donnees['Application'] ?>
<td width="20" ><?php echo $donnees['NumSHS'] ?>
<td width="100"><?php echo $donnees['Objet'] ?>
<td width="100"><?php echo $donnees['Commentaire'] ?>
<td width="8" align=center <font color="red"><?php echo $donnees['Cloturer'] ?> </font>
</tr>
<br>
</table>
<?php
}
mysql_close(); // Déconnexion de MySQL
?> -
<td align="center" width="5"><?php echo $donnees['DateDemande'] ?></td>
<td width="30" align=center><?php echo $donnees['Application'] ?></td>
<td width="20" ><?php echo $donnees['NumSHS'] ?></td>
<td width="100"><?php echo $donnees['Objet'] ?></td>
<td width="100"><?php echo $donnees['Commentaire'] ?></td>
<td width="8" align="center"> <font color="red"><?php echo $donnees['Cloturer'] ?></font></td> -
enlève le <br/> il ne sert a rien ici et le </table> doit etre après la boucle
-
MAGNIIFIQUE
Un trés trés grand merci pour tes réponses et tes compétences
Bonne journée
et merci encore .