Hello,
I have not extensive experience with PHP beyond VERY basic stuff (using mostly mail, include files, etc) though I am now on hunt for an answer about a reading from flat file. Searched for long time but cannot find the answer.
I am designing a website that will have on each page a slider. There is several files, but each page will display the slides (div with some text) in different order. I was hoping to find a script that would do exactly that. Curently I made it work but it displays the divs in the same order and I can see now why. Is there a way to specify lines in the text file that I would then echo to the php file? Currently I have
<?php
$fp = fopen('flat.txt','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
$loop = 0;
while (!feof($fp)) {
$loop++;
$line = fgets($fp, 1024); //use 2048 if very long lines
$field[$loop] = explode ('|', $line);
echo
$field[$loop][0];
$fp++;
}
fclose($fp);
?>
anybody knows how to read it where only specific lines (say 5,3,6) would be displayed?