kaveman50 Posted November 29, 2009 Share Posted November 29, 2009 How could I have a main text file, for instance PRIMARY.txt that has scores of certain tests, but then make 2 more txt files using php that'll make it so that it'll show scores lower than 50 in a file called lower.txt and the scores greater than 50 in a file called higher.txt? Anyone know? Quote Link to comment https://forums.phpfreaks.com/topic/183324-files/ Share on other sites More sharing options...
MadTechie Posted November 30, 2009 Share Posted November 30, 2009 read file into array sort, then get the first 50 chunk and write them to a file reverse the sort and get the first 50 chunk and write them to a file Quote Link to comment https://forums.phpfreaks.com/topic/183324-files/#findComment-967796 Share on other sites More sharing options...
kaveman50 Posted November 30, 2009 Author Share Posted November 30, 2009 ?? This is what I have so far. I'm not sure where to go from here though. <? $grades=array(); $file=fopen("grades.txt","r") or exit("Unable to open file!"); $file=fopen("HIGHER.txt","r") or exit("Unable to open file!"); $file=fopen("LOWER.txt","r") or exit("Unable to open file!"); while(!feof($file)) { $f = fgets($file); array_push($grades, $f); } $arr[$i] = explode('", ', $grades[$i]); fclose($file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/183324-files/#findComment-967884 Share on other sites More sharing options...
MadTechie Posted November 30, 2009 Share Posted November 30, 2009 Erm.. dose that even work ? what does grades.txt look like ? Quote Link to comment https://forums.phpfreaks.com/topic/183324-files/#findComment-967887 Share on other sites More sharing options...
kaveman50 Posted November 30, 2009 Author Share Posted November 30, 2009 I'm probably really off. It's just coming up blank. I guess I should just start over... Quote Link to comment https://forums.phpfreaks.com/topic/183324-files/#findComment-967890 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.