ok, I did it.
Choosed to go with a pipeline separeted text file for storing data 🙂

I wonder what is the fastes and most efficient( performance wise) way to update a row?
From examples and tips I've seen so far it seems that reading the whole file into an array find the matching id's and replace that row with the new data.

If it is a small file thats ok, but what about larger files?
Could an update operation be done more efficient, than the example above?

any tips, sugestions.

    If you were using large files, flat file database might not be the most appropriate way to go. I've never used flat file in PHP, however, way back in the early days of perl before MySQL was widespread, I remember how incredibly inefficient flat file databases were. They were great and quick for very small databases. But once the files got larger, it became problematic. It was this very problem that eventually forced me to learn MySQL.

    So with MySQL so readily available and widely used these days and supported in PHP, why work with flatfiles at all?

      The one thing you have to consider with a flat file solution is that every time you do a transaction, you are going to have to read the whole file. There's really no way around this. One this grows large, doing simple reads for one line could take many extra seconds/minutes/hours/whatever that using a regular RDMS would not take.

        It is nothing serious, just a litle project I do for a friend of mine.
        The will get aprox 50-60 Kb

          Write a Reply...