PHP MYSQL - Affichage par date anglais
Fermé
anthony2008
-
17 oct. 2007 à 22:16
s.spark Messages postés 2485 Date d'inscription vendredi 29 octobre 2004 Statut Contributeur Dernière intervention 13 février 2018 - 21 oct. 2007 à 16:10
s.spark Messages postés 2485 Date d'inscription vendredi 29 octobre 2004 Statut Contributeur Dernière intervention 13 février 2018 - 21 oct. 2007 à 16:10
Bonjour,
J'ai crée un champ de date sur ma table video "mysql windows"
date en forme date
Mes article s'affichent bien dans l'ordre des dates mais la date est en anglais - 2007-05-01
j'aimerais l'avir en francais
_____________________________________
voici mon code php qui permet l'affichage
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." ORDER BY date DESC LIMIT $page,$parpage");
J'ai crée un champ de date sur ma table video "mysql windows"
date en forme date
Mes article s'affichent bien dans l'ordre des dates mais la date est en anglais - 2007-05-01
j'aimerais l'avir en francais
_____________________________________
voici mon code php qui permet l'affichage
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." ORDER BY date DESC LIMIT $page,$parpage");
A voir également:
- PHP MYSQL - Affichage par date anglais
- @ Clavier anglais - Guide
- Trier par date excel - Guide
- Affichage double ecran - Guide
- Mysql community server - Télécharger - Bases de données
- Nbcar en anglais - Guide
10 réponses
s.spark
Messages postés
2485
Date d'inscription
vendredi 29 octobre 2004
Statut
Contributeur
Dernière intervention
13 février 2018
618
18 oct. 2007 à 01:12
18 oct. 2007 à 01:12
Salut,
Mets ça :
DateTemps contient la date dans le format voulu.
Mets ça :
$commaff= mysql_query("SELECT champs1, champs2, champs_etc, DATE_FORMAT(date, \'%d-%m-%Y\') AS DateTemps FROM ".T_VIDEOCAST." ORDER BY date DESC LIMIT $page,$parpage");
DateTemps contient la date dans le format voulu.
Merci beaucoup de ta réponse rapide, j'ai essayer mais ca ne veu rien savoir, peu etre une erreur dans ma manière d'inserer ce code ? aurais tu un bout de code complet ? avec mes champs ?
Merci de ton aide
Merci de ton aide
s.spark
Messages postés
2485
Date d'inscription
vendredi 29 octobre 2004
Statut
Contributeur
Dernière intervention
13 février 2018
618
18 oct. 2007 à 03:47
18 oct. 2007 à 03:47
"j'ai essayer mais ca ne veu rien savoir"
C'est vague ...
"aurais tu un bout de code complet ? avec mes champs ? "
J'ai oublié ma boule de cristal.
Bien sur il faut que ton champs date soit de typte datetime.
C'est vague ...
"aurais tu un bout de code complet ? avec mes champs ? "
J'ai oublié ma boule de cristal.
Bien sur il faut que ton champs date soit de typte datetime.
Voila ma source php
merci pour ton aide
<?php
$total=0;
$parpage=10;
if(isset($_GET['page']))
$page=$_GET['page'];
else
$page=0;
if(isset($_GET['cat'])){
$cat=$_GET['cat'];
$totalid=mysql_query("SELECT * from ".T_VIDEOCAST." WHERE idcat='$cat' ORDER BY id LIMIT $page,$parpage ");
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." WHERE idcat='$cat' ORDER BY id LIMIT $page,$parpage ");
}else
{
$totalid=mysql_query("SELECT * from ".T_VIDEOCAST."");
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." ORDER BY date DESC LIMIT $page,$parpage");
}
while ($donnees = mysql_fetch_array($totalid))
{
$total++;
}
while ($donnees = mysql_fetch_array($commaff))
{
$max=150;
$chaine=$donnees['description'];
if(strlen($chaine)>=$max)
{
$chaine=substr($chaine,0,$max);
$espace=strrpos($chaine," ");
if($espace)
$chaine=substr($chaine,0,$espace);
$chaine .= ' ...';
}
$numero=$donnees[0];
echo'<table id="Tableau_01" width="720" height="106" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/videosradio_01.png" width="720" height="8" alt=""></td>
</tr>
<tr>
<td><table width="720" height="88" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="images/videosradio_02.png"><div align="center">
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="artiste">
<tr>
<td width="11%" valign="top"><table width="70" height="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" ><div ><a href="lecturevideos.php?numero='.$donnees['id'].'"><img src="podcast/images/'.$donnees[4].'" width="83" height="83" border="0" class="glossy iradius" margin-bottom:5px;"></a></div></td>
</tr>
</table></td>
<td width="89%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><a href="lecturevideos.php?numero='.$donnees['id'].'"> <strong>'.stripslashes ($donnees['titre']).'</strong></a><strong> </strong>- '.$donnees['date'].'<br>
'.stripslashes ($chaine).'</td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<img src="images/videosradio_03.png" width="720" height="10" alt=""></td>
</tr>
</table><br />
';
}
?>
merci pour ton aide
<?php
$total=0;
$parpage=10;
if(isset($_GET['page']))
$page=$_GET['page'];
else
$page=0;
if(isset($_GET['cat'])){
$cat=$_GET['cat'];
$totalid=mysql_query("SELECT * from ".T_VIDEOCAST." WHERE idcat='$cat' ORDER BY id LIMIT $page,$parpage ");
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." WHERE idcat='$cat' ORDER BY id LIMIT $page,$parpage ");
}else
{
$totalid=mysql_query("SELECT * from ".T_VIDEOCAST."");
$commaff= mysql_query("SELECT * FROM ".T_VIDEOCAST." ORDER BY date DESC LIMIT $page,$parpage");
}
while ($donnees = mysql_fetch_array($totalid))
{
$total++;
}
while ($donnees = mysql_fetch_array($commaff))
{
$max=150;
$chaine=$donnees['description'];
if(strlen($chaine)>=$max)
{
$chaine=substr($chaine,0,$max);
$espace=strrpos($chaine," ");
if($espace)
$chaine=substr($chaine,0,$espace);
$chaine .= ' ...';
}
$numero=$donnees[0];
echo'<table id="Tableau_01" width="720" height="106" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/videosradio_01.png" width="720" height="8" alt=""></td>
</tr>
<tr>
<td><table width="720" height="88" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="images/videosradio_02.png"><div align="center">
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="artiste">
<tr>
<td width="11%" valign="top"><table width="70" height="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" ><div ><a href="lecturevideos.php?numero='.$donnees['id'].'"><img src="podcast/images/'.$donnees[4].'" width="83" height="83" border="0" class="glossy iradius" margin-bottom:5px;"></a></div></td>
</tr>
</table></td>
<td width="89%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><a href="lecturevideos.php?numero='.$donnees['id'].'"> <strong>'.stripslashes ($donnees['titre']).'</strong></a><strong> </strong>- '.$donnees['date'].'<br>
'.stripslashes ($chaine).'</td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<img src="images/videosradio_03.png" width="720" height="10" alt=""></td>
</tr>
</table><br />
';
}
?>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
s.spark
Messages postés
2485
Date d'inscription
vendredi 29 octobre 2004
Statut
Contributeur
Dernière intervention
13 février 2018
618
19 oct. 2007 à 17:47
19 oct. 2007 à 17:47
Tu n'a toujours pas dis quel est le type de ton champs date, et ça serait bien de savoir comment tu remplis ce champs.
Bonjour, je suis de retour,
voila, je l'ai mis en format 'DATE'
avec DATETIME, je ne veux pas car il met les minutes
Merci de ton aide
voila, je l'ai mis en format 'DATE'
avec DATETIME, je ne veux pas car il met les minutes
Merci de ton aide
s.spark
Messages postés
2485
Date d'inscription
vendredi 29 octobre 2004
Statut
Contributeur
Dernière intervention
13 février 2018
618
21 oct. 2007 à 16:10
21 oct. 2007 à 16:10
Désole j'arrête de t'aider ici, tu ne réponds pas aux questions.