Re: Newbie Question

From: Date: Mon, 08 Apr 2002 13:52:58 +0000
Subject: Re: Newbie Question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-12965@lists.php.net to get a copy of this message
At 03:31 PM 4/8/2002 +0200, Alberto. Sartori wrote:
You should do the cicle and get the datas until you reach the end of file aka feof($fp) or better, try to use fread()
Yup, good point. Here's the modified code.. not using fread() though. For non-binary data I think this should work ok though. <?php $fp = fopen ("album.dat","r"); while (!feof($fp)) {
    $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>");
} fclose($fp); ?>

« previous php.windows (#12965) next »