Ok, so please excuse how new to php I am...
I have a CSV file with about a thousand entries in it. I can pull up all of the data in that csv file using:
CODE
<?php
$row = 1;
$handle = fopen("test.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />\n";
}
}
fclose($handle);
?>
And that will display all of the information in that file. What I'm trying to accomplish is everytime the script is run, I want it to pull only a single item from the csv file. So the first time it's run, it'll pull line 0, the second time line 1, the third time line 2, and so on, so that only 1 line is displayed at a time, and each time it changes to the next one in order. How would I accomplish this??
What I'm trying to accomplish is a link being updated once every 20 minutes or so using a cron job, pulling the updated link from the CSV file so that my $data variable can display it on my site.
Thanks!
This post has been edited by tyler3: 8 May, 2008 - 08:45 AM