Sesquipedalian Posted November 6, 2008 Share Posted November 6, 2008 For some reason it won't display what the error is with my code.. This is just an exert of some code, but I know that there is an error somewhere in here that is messing up my other code, I just can't find it. What do you think?: <? $assignments = 'assignments.txt'; $archive = 'archive.txt'; chmod($archive, '0777'); chmod($assignments, '0777'); if ($handle['assignments'] = fopen($assignments, 'r')) { if ($read = fread($handle['assignments'], filesize($assignments))) { if ($handle['archive'] = fopen($archive, 'a')) { $string = $_POST['subject'].'|'.$_POST['assignment'].'|'.$_POST['date']; $read = explode("\n", $read); for ($i=0;$read[$i]!==NULL;$i++) { if ($read[$i] !== $string) { $newread .= $read[$i]; if ($read[$i+1]!==NULL) { $newread .= "\n"; } } else { $archivedstring = $read[$i]; } } fclose($handle['assignments']); if (fwrite(fopen($assignments, 'w'), $newread)) { if (fwrite($handle['archive'], $archivedstring)) { echo '<script>self.close();</script>'; } else { echo 'Cannot write to archive.txt'; } } else { echo 'Cannot write to assignments.txt'; } } else { echo 'Cannot open '.$archive.' for writing.'; } } else { echo 'Cannot read '.$assignments; } } else { echo 'Cannot open '.$assignments.' for reading'; } ?> Link to comment https://forums.phpfreaks.com/topic/131572-solved-error-with-code-but-wont-display-what/ Share on other sites More sharing options...
corbin Posted November 6, 2008 Share Posted November 6, 2008 error_reporting(E_ALL); ini_set('display_errors', '1'); Put that at the top, and it should atleast give you some kind of error. Link to comment https://forums.phpfreaks.com/topic/131572-solved-error-with-code-but-wont-display-what/#findComment-683378 Share on other sites More sharing options...
Sesquipedalian Posted November 7, 2008 Author Share Posted November 7, 2008 That actually was at the top of the rest of the code (since this was just an excert). I found out what the problem was by just switching a few things around. Thanks anyways though. Link to comment https://forums.phpfreaks.com/topic/131572-solved-error-with-code-but-wont-display-what/#findComment-684355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.