jeaker Posted October 26, 2006 Share Posted October 26, 2006 I want to be able to allow the user to pull in the file grades.txt for editing. The user should be allowed to add a name a series of grades, change grades on existing data, or add grades to an existing student. I want to use -2 as the end of file indicater and -1 as the end of line mark.(ex. johndoe233498-1janedoe2132-2)If anyone can help me with this it will be greatly appreciated and thanks sooo much in advance.Here is some code that i have gotten together so far.[code]<html><head><title>Edit Student Data</title></head><body><?php$line = file("Grades.txt");$i = 0;$num = 0;$cnt = 0;while ($line[$i] != -2) { $first = $line[$i]; $i++; $last = $line[$i]; $i++; while ($line[$i] != -1) { $num = $num + $line[$i]; $cnt++; $i++; }$num = $cnt > 0 ? $num / $cnt : 0;echo "$last, $first, $num<br />";$i++;$cnt = 0;$num = 0;}?>[/code] Link to comment https://forums.phpfreaks.com/topic/25135-trouble-with-file-editing/ Share on other sites More sharing options...
php_joe Posted October 26, 2006 Share Posted October 26, 2006 ***post removed by Joe*** Link to comment https://forums.phpfreaks.com/topic/25135-trouble-with-file-editing/#findComment-114842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.