par
lefox88500 » 06 juil. 2005, 16:01
merci beaucoup pour ce debut d'aide je precise je suis un vrai debutant 3 jour de php
je precise j'ai repris une partie sur un site car je ne savais pas du tout comment faire
voici mon code:
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 futur
merci beaucoup pour ce debut d'aide je precise je suis un vrai debutant 3 jour de php
je precise j'ai repris une partie sur un site car je ne savais pas du tout comment faire
voici mon code:
[php]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]
merci pour les reponses futur