SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Slarti42's Avatar
    Join Date
    May 2001
    Location
    UK
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    unique field in a flat file

    Does anyone know a way to check for and set a unique key in a flat text file. I know how to do it with mysql but thats not an option on this page.

    I'm creating a quick 'latest news' section and I don't have mysql on the server the site is on.

    Any ideas received with thanks

    Slarti

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Insert the newest news at the top of the file and then you can just use the first 5, or whatever, lines as latest news

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could just use a simple pipe-delimted format or something:

    1|blah blah blah
    2|another record
    3|and so on

    If you keep each record on a seperate line you can read the whoe file into an array (one line for each element) using the file() function then use explode() on each line to get the ID number.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •