Jump to content

mauricederegt

New Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

mauricederegt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I have the following code to add a new line in a text file: if(!empty($name)){ $fp = fopen($croom."_test.txt", 'a'); fwrite($fp, '<div id="'.$id.'"><b>'.$name.'</b>: '.$msg.'<br/></div>'.PHP_EOL); fclose($fp); } Everytime this is executed, the text file will grow like this: <div id="234"><b>Jake</b>: blabla<br/></div> <div id="345"><b>Sam</b>: sfsfe<br/></div> <div id="234"><b>Jake</b>: yyujyuj<br/></div> <div id="098"><b>Bob</b>: bnhngn<br/></div> In time this text file will grow huge. I want to prevent this by overwriting the line containing a certain word/ id (lets say: 234) In the example above you see that Jake is in there twice, this should not be allowed. The second line from Jake should overwrite the first line from him, so each id has just 1 line of text in the text file. How to do this? How to edit my code above to achieve this? Hope anyone can help. Many thanks A coding newbie
  2. I have a similar problem: I have tried the following: // We're NOT on the home page if (strpos($_SERVER['REQUEST_URI'], "/games/mahjong/mahjong.php") >= 0) { $style = "display: none"; } else { $style = "display: inline"; } But if I go to /games/mahjong/mahjong.php?layout it doesn't change the style. I've echoed: echo $_SERVER['REQUEST_URI']; and it changes to /games/mahjong/mahjong.php?layout so why isn't the style set to inline? I also tried: // We're NOT on the home page if (strpos($_SERVER['REQUEST_URI'], "/games/mahjong/mahjong.php") === false) etc etc But this results just in NOT hiding (show style = display: inline) Kind regards, Maurice
×
×
  • 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.