Loop read each line of a file to its own array
You're using a database function to loop through a database table - that's fine. To get file contents into an array, use file(). Example:
$filename = 'info.txt';
$contents = file($filename);
foreach($contents as $line) {
echo $line . "\n";
}
All of the substr()
stuff could be made easier with strtotime()
and/or date()
I'm sure:
$lines = file('/path/to/file.txt');
foreach($lines as $row) {
//whatever here
}