WebDeveloper.com

WebDeveloper.com (http://www.webdeveloper.com/forum/index.php)
-   PHP (http://www.webdeveloper.com/forum/forumdisplay.php?f=16)
-   -   Flat file database (http://www.webdeveloper.com/forum/showthread.php?t=40270)

neenach2002 07-24-2004 06:33 PM

Flat file database
 
I'm not sure how to create a flat-file database.

And how do I tell PHP what the separators in the file are? Spaces, tabs, returns, et cetera.:confused: :confused: :confused:

MstrBob 07-24-2004 06:48 PM

Why do you want a flat file database? Though it can be made, it's really pointless. I made my blog flatfile, thus creating a pseudo database, but it was way more complicating than necessary. There's a reason systems like MySQL and Oracle are around.

But, basically, I created a directory, and each new entry was a numbered file. If the last file was 5.txt, the next one was 6.txt . Since I didn't allow html to be entered (I used htmlentities for entered info) I used <S> as a seperator for info. Then I did something like this:

PHP Code:

$data_file = file_get_contents("dir/5.txt");
$data = split("<S>", $data_file);

Then the information is stored in the array $data. If my first information was, say, title, then I could call title like

$data[0]

Basically.

neenach2002 07-24-2004 06:50 PM

I want to use a flat-file databse because I can't seem to get a database connection working.


All times are GMT -5. The time now is 02:41 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.