Alex Piotto
08-19-2002, 03:41 PM
Hi everybody!
I am trying to read a db like this:
id;author;title;usdprice;
0;Agatha Cristie;Evil under the sun;50;
1;Arthur Conan Doyle;A study in Scarlet;75;
2;Raymond Chandler;Farewell my Lovely;28;
3;Stefano Benny;Hearth;35;
4;Alex Ross;Maputo by night;15;
with this code:
<?
$fname="test.txt";
$fp=fopen($fname,"r") or die("Error!");
$line = fgets($fp,1024);
while(!feof($fp))
{
list($id,$author,$title,$usdprice) = split( ";", $line, 4 );
echo "$id - $author - $title - $usdprice<br>";
$line = fgets( $fp, 1024 );
}
fclose($fp);
?>
but I can't see the last row of the db......?
What's wrong?
Alex :confused:
I am trying to read a db like this:
id;author;title;usdprice;
0;Agatha Cristie;Evil under the sun;50;
1;Arthur Conan Doyle;A study in Scarlet;75;
2;Raymond Chandler;Farewell my Lovely;28;
3;Stefano Benny;Hearth;35;
4;Alex Ross;Maputo by night;15;
with this code:
<?
$fname="test.txt";
$fp=fopen($fname,"r") or die("Error!");
$line = fgets($fp,1024);
while(!feof($fp))
{
list($id,$author,$title,$usdprice) = split( ";", $line, 4 );
echo "$id - $author - $title - $usdprice<br>";
$line = fgets( $fp, 1024 );
}
fclose($fp);
?>
but I can't see the last row of the db......?
What's wrong?
Alex :confused: