Jump to content

fwrite problems


moon 111

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.