Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2001
Posts: 26
MHB
Offline
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 26
Right, I have a script.
You fill in a form and it writes the infomation one after the other.
Code
code:

How would I make it so that new entrie go at the top?

I've done a search before I posted, and it came up with nothing. So if this was been mnetioned before, please just point me in the direction and dont flame me shocked laugh

Cheers smile

Sponsored Links
Joined: Jul 2000
Posts: 1,349
Ell Offline
Member
Member
Offline
Joined: Jul 2000
Posts: 1,349
AFAIK, you can't write directly to the top of the file without overwriting the contents below... the ">>" in the open basically means "append". I think the seek() function only allows for binary editing of a file...

Here's a solution: (I hope)

Code
code:

Apologies for the inefficient code, but I'm on a foreign computer, and can't remember the "open AND write" option. laugh ("+>" or something?)

Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
Just curious, why do you need to write to the top instead of the end of the file? Everything can be read into an array and accessing the last elements are just as easy as the first. It makes no diff to the computer smile


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
Joined: Feb 2000
Posts: 4,625
Member
Member
Offline
Joined: Feb 2000
Posts: 4,625
Or a hash, if you so choose to do it that way. (I dont know your script, so i dont know if a hash would be better for you or not)


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,825
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 5263
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 5
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)