Re: Newbie Question

From: Date: Mon, 08 Apr 2002 13:30:13 +0000
Subject: Re: Newbie Question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-12963@lists.php.net to get a copy of this message
Give this a shot... <?php $row = 1; $fp = fopen ("album.dat","r"); while ($data = fgets($fp)) {
    $values = explode(';', $data);
    list($vignette, $photo, $marque, $nom, $pdfproduit, $commprod) = $values;
    print("<tr>");
    print("<td>$vignette</td>");
    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>");
} ?> At 08:54 AM 4/8/2002 +0200, 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 : <?php $row = 1; $fp = fopen ("album.dat","r"); while ($data = fgetcsv ($fp, 1000, ";")) { $num = count ($data); $row++; if (isset($vignette)) { print(" "); print("$vignette"); // I think it's wrong here but I dont know why ==> print("10e834.jpg"); print("$marque"); print("$nom"); print("$pdfproduit"); print("$commprod"); print(" "); } 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; } } } ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Mike Flynn - Burlington, VT http://www.mikeflynn.net/ - mike@mikeflynn.net home=>work=>home=>store=>home [repeat daily]

« previous php.windows (#12963) next »