1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Using a .txt file as a database

Discussion in 'Content Management' started by EGS, Mar 26, 2006.

  1. #1
    Hi. Can someone please tell me how I can make a .txt file act like a MySQL database? I know CuteNews does it somehow and I would like to do it to make my own little custom CMS if I am smart enough!

    Help is appreciated.
    Thanks! :)
     
    EGS, Mar 26, 2006 IP
  2. xfairguy

    xfairguy Well-Known Member

    Messages:
    441
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Here it is.
    http://www.c-worker.ch/txtdbapi/index_eng.php

    What is the "PHP-TextDB API" ?

    If you wanted to make a dynamic PHP-Website you've had two choices:

    1. You could save your data in a self-defined formatted text files. This has one big
    disadvantage: You would have none of the advantages a SQL database would provide,
    such as performing common SQL commands as SELECT, INSERT, and UPDATE, as well as filtering or ordering the result of queries. .

    2. You could host your website on a webserver that provides database software, but
    web hosting options on such a Server cost additional funds.

    That's where the "Txt-Db-API" could help.
    With the "Txt-Db-API" you can access normal Text Files like a SQL Database.
    You don't need any special database software on the webserver, yet you can still use SQL!
    You can use the API to create, query, change, delete, SQL tables, and you don't
    have to bother with the Text-Files themself; Almost everthing can be done with
    the supported API calls.The Txt-Db-API is object oriented and is very simple to use (IMHO :)).
    Disadvantages of the Txt-DB-API: It doesn't perform as well as a true production database system.
     
    xfairguy, Mar 26, 2006 IP
  3. illusion

    illusion Peon

    Messages:
    427
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well actually you are wrong. I wrote a class that allows me to use those functions on specified text files, really depends on your skill level
     
    illusion, Mar 26, 2006 IP
  4. seolion

    seolion Active Member

    Messages:
    1,495
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    90
    #4
    At one instance I have also used plain text files to store data..
    Agsin it depends on the skill level, but not impossible..
     
    seolion, Mar 27, 2006 IP
  5. EGS

    EGS Notable Member

    Messages:
    6,078
    Likes Received:
    438
    Best Answers:
    0
    Trophy Points:
    290
    #5
    Sweet. Thank you much! :)
     
    EGS, Mar 27, 2006 IP
  6. dfsweb

    dfsweb Active Member

    Messages:
    1,587
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    88
    #6
    That's true, but I don't see why you would want to do this. I mean, is it really worth the hassle when you can get a hosting plan with MySQL and plenty of hosting space for just a couple of bucks a month? Is there any specific reason why you are looking at setting this up the way you are?

    I mean, I have used txt files for storing data when I only needed a list of 10 items (say) and knew that I would never really edit these again. And, I only used a txt file 'cos I was too lazy to log into my MySQL server and create a new table. :rolleyes: But, if you are looking at frequently updating and editing this data, it might pay to reconsider and set it up properly as a database.
     
    dfsweb, Mar 27, 2006 IP