Jump to content

[SOLVED] Flat File Databases


Altec

Recommended Posts

I'm writing a very small test script to get familiar with flat file database techniques. In this case I'm using just a text file and plan on using a pipe ( | ) to separate my fields. However, I'm interested in limiting how many rows are stored. For example, if I wanted to limit how many comments are stored, and each subsequent comment made "pushes" the oldest comment out, how would I do this?

 

I should also mention I know the basics of reading and writing to files.

Link to comment
https://forums.phpfreaks.com/topic/140284-solved-flat-file-databases/
Share on other sites

use \x01 to seperate your fields, you will never get someone to input \x01 and if they do.. just do

 

str_replace("\x01","",$inputText);

 

because I use | alot lol even outside of programming..

 

and the best method I guess.. would be to read out your file.. append your new input text to the array containing all other comments.. get the last 10 elements of the array, then clear the text from the file then put the 10 elements you've gotten back into the file..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.