Re: How to get new row on top?

From: Date: Sat, 17 Feb 2001 11:25:30 +0000
Subject: Re: How to get new row on top?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40317@lists.php.net to get a copy of this message
if ($message) { /* uncomment the next two lines to strip out html from input */ /* $name = strip_tags($name); */ /* $message = strip_tags($message); */ $message = ereg_replace("\r\n\r\n", "\n<P>", $message); $date = date("l, F j Y, h:i a"); $message = "<B>$name </B> -- $date<P> $message <BR><HR>"; $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fseek($fp, 0); // works both with php4.0.1pl1 <, > fwrite ($fp, $message); fclose ($fp); } @readfile(basename(($PHP_SELF . ".comment"))); --- Jan Grafström <jan@lillemanshus.com> wrote: > > Thank You for the answer. > > Here is my file: > > if ($message) > { > /* uncomment the next two lines to strip out > html from input */ > /* $name = strip_tags($name); */ > /* $message = strip_tags($message); */ > $message = ereg_replace("\r\n\r\n", "\n<P>", > $message); > $date = date("l, F j Y, h:i a"); > $message = "<B>$name </B> -- $date<P> $message > <BR><HR>"; > $fp = fopen (basename($PHP_SELF) . ".comment", > "a"); > fwrite ($fp, $message); > fclose ($fp); > } > @readfile(basename(($PHP_SELF . ".comment"))); > ----- > And here is a html form placed. > ----- > When I submit the form I can se the result on the > top of the same page with newest message at the > bottom. > > I you know how to get latest message at the toprow I > am greatful for an answer. > > Regards > Jan > > 2001-02-16 18:38:36, Mukul Sabharwal > <mukulsabharwal@yahoo.com> wrote: > > >I'm not quite sure what that code has to do with > >anything, but anyway, > > > >incase you're using files, > > > >you can open the file with the 'a' flag, using > fseek > >goto 0byteth, and append from there. > > > >$fp = fopen('file', 'a'); > >fseek($fp, 0); > >fwrite... or whatever here. > > > > > >--- Jan Grafström <jan@lillemanshus.com> wrote: > > 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 > >> > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, e-mail: > >> php-general-unsubscribe@lists.php.net > >> For additional commands, e-mail: > >> php-general-help@lists.php.net > >> To contact the list administrators, e-mail: > >> php-list-admin@lists.php.net > >> > > > > > >===== > >To find out more about me : > http://www.geocities.com/mimodit > >My bookmarks are available @ http://mukul.free.fr > > > >__________________________________________________ > >Do You Yahoo!? > >Get personalized email addresses from Yahoo! Mail - > only $35 > >a year! http://personal.mail.yahoo.com/ > > > > > > Jan Grafström > Lillemans Hus AB > Sweden > +46 (0)611 60920 > +46 (0)70 6409073 > > ===== To find out more about me : http://www.geocities.com/mimodit My bookmarks are available @ http://mukul.free.fr __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/

« previous php.general (#40317) next »