html>
<head>
<title>MVM</title>
</head>
<body>
<TABLE border=2 width=975>
<tr>
<td width=158 height=173>
<img src="logo.jpg" width="157.5" height="172.5" alt="" border="0" />
</td>
<td valign="top">
<FONT SIZE=2>
<FONT COLOR="#0000FF">
<div align="right">
<?php
$date = date("d-m-Y");
Print("Nous sommes le $date");
?>
<br>
<FONT SIZE=2>
<?php
$heure = date("H:i");
Print("il est $heure");
?>
</div>
</FONT>
</td>
</tr>
<tr>
<td width=500 height=200>
<?
$separateur=",";
$champ="c:\EasyPHP1-8\www\champ.csv";
function read_csv( $champ, $separateur) // transfert le fichier dans un tableau
{
if ( $FILE=fopen($champ,"r") ) // ouverture du fichier
{
while ($ARRAY[]=fgetcsv($FILE,1024,$separateur)); // lire ligne par ligne et coupe colonne par colonne
fclose($FILE) ;
array_pop($ARRAY); // ferme le fichier // efface la derniere ligne
return $ARRAY ; // renvoie le tableau
}
}
$ARRAY=read_csv($champ,$separateur); // lit le fichier
?>
<?
$heigh=sizeof($ARRAY); // compte le nombre de ligne
$width=sizeof($ARRAY[0]);
echo"width $width";
echo"heigh $heigh";
// nombre de colonne par ligne
echo "<TABLE>"; // ouvre la tableau HTML
for($i=0;$i<$heigh;$i++) // les données du tableau
{
echo "<TR>\n"; // Nouvelle ligne
for($j=0;$j<$width;$j++) // affiche colonne par colonne
{
echo "<TD>";
if( $ARRAY[$i][$j]=="" ) // si la case est vide
echo " "; // n'affiche rien
else // sinon
{
echo "<center>";
echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES);// affiche les données
echo "</center>";
}
echo "</TD>\n"; // ferme la colonne
}
echo "</TR>\n"; // ferme la ligne
}
echo "</TABLE>\n"; // tableau terminé // Fin tableau
?>
</td>
</tr>
</table>
</body>
</html>
merci pour les reponses futurCode : Tout sélectionner
[php][/php] echo"width $width";
echo"heigh $heigh";
cela affiche la bonne taille ou pas ? (savoir si il y a quelque chose dans le tableau)fgetcsv($FILE,1024,$separateur)) dans le while histoire de voir ce qui est inscrit dans le tableau.<html>
<head>
<title>MVM</title>
</head>
<body>
<TABLE border=2 width=975>
<tr>
<td width=158 height=173>
<img src="logo.jpg" width="157.5" height="172.5" alt="" border="0" />
</td>
<td valign="top">
<FONT SIZE=2>
<FONT COLOR="#0000FF">
<div align="right">
<?php
$date = date("d-m-Y");
Print("Nous sommes le $date");
?>
<br>
<FONT SIZE=2>
<?php
$heure = date("H:i");
Print("il est $heure");
?>
</div>
</FONT>
</td>
</tr>
<tr>
<td width=500 height=200>
<?
$separateur=",";
$champ="c:\EasyPHP1-8\www\champ.csv";
function read_csv( $champ, $separateur) // transfert le fichier dans un tableau
{
if ( $FILE=fopen($champ,"r") ) // ouverture du fichier
{
while ($ARRAY[]=fgetcsv($FILE,1024,$separateur)); // lire ligne par ligne et coupe colonne par colonne
fclose($FILE) ;
array_pop($ARRAY); // ferme le fichier // efface la derniere ligne
return $ARRAY ; // renvoie le tableau
}
}
$ARRAY=read_csv($champ,$separateur); // lit le fichier
?>
<?
$heigh=sizeof($ARRAY); // compte le nombre de ligne
$width=sizeof($ARRAY[0]);
echo"width $width";
echo"heigh $heigh"; // nombre de colonne par ligne
echo "<TABLE>"; // ouvre la tableau HTML
for($i=0;$i<$heigh;$i++) // les données du tableau
{
echo "<TR>\n"; // Nouvelle ligne
for($j=0;$j<$width;$j++) // affiche colonne par colonne
{
echo "<TD>";
if( $ARRAY[$i][$j]=="" ) // si la case est vide
echo " "; // n'affiche rien
else // sinon
{
echo "<center>";
echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES);// affiche les données
echo "</center>";
}
echo "</TD>\n"; // ferme la colonne
}
echo "</TR>\n"; // ferme la ligne
}
echo "</TABLE>\n"; // tableau terminé // Fin tableau
?>
</td>
</tr>
</table>
</body>
</html>
[/php ]
et voici la sortie php
width 1heigh 7g;7
f;6
e;5
d;4
c;3
b;2
a;1<html>
<head>
<title>MVM</title>
</head>
<body>
<TABLE border=2 width=975>
<tr>
<td width=158 height=173>
<img src="logo.jpg" width="157.5" height="172.5" alt="" border="0" />
</td>
<td valign="top">
<FONT SIZE=2>
<FONT COLOR="#0000FF">
<div align="right">
<?php
$date = date("d-m-Y");
Print("Nous sommes le $date");
?>
<br>
<FONT SIZE=2>
<?php
$heure = date("H:i");
Print("il est $heure");
?>
</div>
</FONT>
</td>
</tr>
<tr>
<td width=500 height=200>
<?
$separateur=",";
$champ="c:\EasyPHP1-8\www\champ.csv";
function read_csv( $champ, $separateur)
{
if ( $FILE=fopen($champ,"r") )
{
while ($ARRAY[]=fgetcsv($FILE,1024,$separateur));
fclose($FILE) ;
array_pop($ARRAY);
return $ARRAY ;
}
}
$ARRAY=read_csv($champ,$separateur);
?>
<?
$heigh=sizeof($ARRAY);
$width=sizeof($ARRAY[0]);
$ARRAY=array_reverse($ARRAY,false);
echo "<TABLE>";
for($i=0;$i<$heigh;$i++)
{
echo "<TR>\n";
$j=1;
echo "<TD>";
if( $ARRAY[$i][$j]=="" )
echo " ";
else
{
echo "<center>";
echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES);
echo "</center>";
}
echo "</TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
?>
</td>
</tr>
</table>
</body>
</html>