moon 111 Posted March 29, 2008 Share Posted March 29, 2008 For some reason the following code isn't working. Any ideas? ($file is defined) <?php function addMessage($name, $message) { $handle = fopen($file, "rw"); if(filesize($file) > 0) $contents = fread($handle, filesize($file)); else $content = ""; $date = date("H:i:s"); $content = $date . ":-:" . $name . ":-:" . $message . "\r\n" . $content; fwrite($handle, $content); } ?> EDIT: found the mistake with $contents/$content but its still not working. Link to comment https://forums.phpfreaks.com/topic/98514-fwrite-problems/ Share on other sites More sharing options...
sasa Posted March 29, 2008 Share Posted March 29, 2008 ($file is defined) EDIT: found the mistake with $contents/$content but its still not working. but not inside function try to pass variable $file with function or make it global (global $file;) before use it Link to comment https://forums.phpfreaks.com/topic/98514-fwrite-problems/#findComment-504147 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.