From this txt file you need to take data
DT1617T2, Problem Solving for Programming, Gordon MacIntyre, 04/08/2016
12345678, 56
34567822, 67
12324654, 98
It should work
File name: ppGM.txt
Module Code: DT1617T2
Module Title: Problem Solving for Programming
Tutor: Gordon MacIntyre
Marked date: 08/04/2016
12345678: 56
34567822: 67
12324654: 98
And I get
DT1617T2 Problem Solving for Programming Gordon MacIntyre 04/08/2016
12345678 56
34567822 67
12324654 98
I need help, I write php for the first time.
function readLineByLine () { if (file_exists('ppGM.txt')){ $tmaFileToOpen = fopen("ppGM.txt", "r"); // open our ppGM.txt file if ($tmaFileToOpen) { // true if no errors occured while(!feof($tmaFileToOpen)) { // variable $result will display data in line by line $result = fgets($tmaFileToOpen, 1024); $split = explode(',', $result); echo '<p>' . $split[0] . $split[1] . $split[2] . $split[3] . '</p>'; } } else { // if an error occured message will be displayed echo '<p>There is an error openning file!</p>'; } fclose($tmaFileToOpen); // Close our ppGM.txt file } else { // if file doesn't exist message will be displayed echo '<p>File requested not found!</p>'; } } echo readLineByLine();