Re: How to get new row on top?
| From: | (Tom) | Date: | Sun, 18 Feb 2001 22:29:43 +0000 |
| Subject: | Re: How to get new row on top? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40475@lists.php.net to get a copy of this message | ||
The approach I've used is four steps:
(1) read the current file into a variable (which preserves it)
(2) open the 'old' file for writing "w" (which clears it also)
(3) write the "new stuf" to the file first
(4) lastly write the "old stuff" to the file
Here's a code sample that I just tested...........
$new_line="<A HREF=\"$URL\" target=\"_myclassy\">
$LABEL</A><BR>\n";
$filecontents = join ('', file('./classified.html'));
$fp=fopen("./classified.html","w");
fwrite($fp,$new_line);
fwrite($fp,$filecontents);
fclose($fp);
Hope that helps, but YMMV.
CHeers,
Tom Henry
jan@lillemanshus.com (Jan Grafström) wrote in
<3A8E51F0.1AE15CF@lillemanshus.com>:
>Hi!
>I have this code:
>$message = ereg_replace("\r\n\r\n", "\n<P>", $message);
>And the new rows are placed under the old ones.
>I want to change so the old messages get placed under is that possible?
>Thanks for help.
>Jan
>
>