$fp = fopen($filename, 'r');
while ($l = fgets($fp, 1000))
{
  list ($parts, $vignette, $marque, $nom, $pdfproduit, $commprod) = 
    explode (';', $l);
  // now use the data
  print "<p>$parts</p>"; // or whatever
}
fclose ($fp);

On Mon, 8 Apr 2002, Hubert DAUL wrote:

> 
> 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>
> 
> 
> 
> 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to