Re: Newbie Question
| From: | Michael Virnstein | Date: | Mon, 08 Apr 2002 09:42:20 +0000 |
| Subject: | Re: Newbie Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92015@lists.php.net to get a copy of this message | ||
try this:
<html>
<head>
<title>Solid</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="384" border="1">
<?php
$fp = fopen ("album.dat","r");
while ($data = fgetcsv ($fp, 1000, ";"))
{
if (isset($data[0]))
{
print("<tr>");
print("<td>".$data[0]."</td>");
print("<td><img src=\"images/".$data[1]."\"><a href
=\"prod.php?file=lecteur.dat\"></a></td>");
print("<td>."$data[2]."</td>");
print("<td>".$data[3]."</td>");
print("<td>".$data[4]."</td>");
print("<td>".$data[5]."</td>");
print("</tr>");
}
}
?>
</table>
</body>
</html>
"Hubert Daul" <hd@mcinet.fr> schrieb im Newsbeitrag
news:20020408065818.96359.qmail@pb1.pair.com...
>
> Hi ,
>
> Here's my problem :
>
> I read a data file (no sql file) which contains 8 lines, and in each line,
8
> datas
>
> (ex: name1;picture1;title1;anything1;everything1;nothing1)
>
> and when i run it I see only one picture(the second data) and not all of
> them
>
> If someone could help me
>
> TYA
>
> Here the code :
>
> <html>
> <head>
> <title>Solid</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <table width="384" border="1">
>
> <?php
> $row = 1;
> $fp = fopen ("album.dat","r");
> while ($data = fgetcsv ($fp, 1000, ";"))
> {
> $num = count ($data);
>
> $row++;
>
> if (isset($vignette))
> {
> print("<tr>");
> print("<td>$vignette</td>");
> // I think it's wrong here but I dont know why
> ==> print("<td><img src=\"images/$photo\"><a href =
> \"prod.php?file=lecteur.dat\"></a></td>");
> print("<td>$marque</td>");
> print("<td>$nom</td>");
> print("<td>$pdfproduit</td>");
> print("<td>$commprod</td>");
> print("</tr>");
> }
>
>
> for ($c=0; $c<$num; $c++)
> switch ($c) {
> case 0 :
> {
> $vignette = $data[$c];
> break;
> }
>
> case 1 :
> {
> $photo= $data[$c];
> break;
> }
>
> case 2 :
> {
> $marque= $data[$c];
> break;
> }
>
> case 3 :
> {
> $nom = $data[$c];
> break;
> }
>
> case 4 :
> {
> $pdfproduit= $data[$c];
> break;
> }
>
> case 5 :
> {
> $commprod = $data[$c];
> break;
> }
> }
> }
> ?>
> </table>
> </body>
> </html>
>
>
>
>
>