look at the filesystem calls in php.
http://www.php.net/manual/en/function.fopen.php
the short answer is that you fopen a file, fread/fwrite the data, then fclose the file. don't forget to flock the file before any writing might occur. file() also might work for reading only.
a flat file "database" really is just a text file with data. sometimes the rows & columns are seperated like in a .csv file. othertimes its formated using html for presentation in the text file such as with a simple guestbook.
in short, its bad mojo to use a flat file "database" for anything that might need to be updated, maintained, or reused.
the last time i used a flat file database was for my .sig. most forums allow sigs with basic html but not dynamic content such as javascript. my workaround was a php script that reads http://www.schnell.to/~brandon/sig_list.txt and creates an image at http://www.schnell.to/~brandon/sig.php
its simple, and while a database might be nice for more features, a flat file "database" is acceptable for now as this was a quick hack.