Hello,
I have a query which I'm sure arises a fair bit.
I have a simple system that uploads and displays a text file via a PHP page. This is a menu page that has a) the item and b) the price.
The text file is comma delimited like so:
poached baby octopus, 16
blue eye tuna, 18
etc etc...
I wish to display this info in a two column table.
I have this:
<?
$datafile = fopen("data/home.txt","r");
$data = fread($datafile, 1000000);
list($item, $price) = explode(",",$data);
echo "<table width=640><tr>";
$menu = "<td width=600>".$item."</td><td width=40>$".$price."</td>";
//wherever line returns are change these for row ends/beginnings
$menu = str_replace(chr(10),"</td></tr><tr><td>",$menu);
echo $menu;
echo "</tr></table>";
?>
(where 'data/home.txt' is the text file source)
but it only displays one row of the data.
Can anyone help?
I'm not sure how to set up the loop structure so as to run through the whole lot of info (which could be 30 items long).
Byron