Forum Moderators: coopster

Message Too Old, No Replies

Flat file database system?

an alternative to mysql

         

ahmedtheking

9:31 pm on Feb 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm back!

I am researching flat file DBs. I know that they are bad, but a client i am working for does not have access to mysql hosting!

What i need to do is to have a set of special offers (say about 8 different special offers, each one consisting of 5 fields (title, link, description, image, end date)).

Is there a way (either using a php 'random' script or using a flat file or even the explode/implode funcs) to generate a random page to display 2 random special offers?

Thanks for any help peeps! :D

labeler2003

9:44 pm on Feb 10, 2005 (gmt 0)

10+ Year Member



With so few offers your client does not really need a database.

Set up each of the eight offers in a separate .html file and use the PHP "INCLUDE" feature. Have PHP randomly select two of the offers to include.

It would look like:

<?php include 'offer1.html'?>

The HTML code in the offer "pages" should only include what normally goes between <body></body> tags, without the body tag however. The HTML code from the offer pages will be inserted into the PHP page. This has the advantage of allowing each offer to look different.

The other option is to store the offer information in a plain text file (or eight text files). Have the PHP read the information from the text file, select two offers, and then write the HTML.

[edited by: labeler2003 at 9:47 pm (utc) on Feb. 10, 2005]

ahmedtheking

9:47 pm on Feb 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah yes! Why didnt I think of that?!

Thanks! :D

Hester

10:00 am on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am researching flat file DBs. I know that they are bad

What's bad about them? I've used them for years. This forum even runs off them!

ahmedtheking

10:22 am on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry to say they're bad!

Ive been taught (and learnt) to avoid flat file!

Ive never had the pleasure of using one, so if you have a tutorial i can read up on, that would be great! :D

Hester

10:42 am on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've two on my website. Go to the Categories page and see the Flat File Database Demo 1 and 2!

villan

5:53 pm on Feb 11, 2005 (gmt 0)

10+ Year Member



Wouldnt the performance rely heavily on the filesystem? It would be an interesting experience to run the same code on ext3, reiserfs, maybe even ntfs to see the differences. As modern file systems keep getting db-like features maybe flat file could see a revival?

py9jmas

6:01 pm on Feb 11, 2005 (gmt 0)

10+ Year Member



As modern file systems keep getting db-like features maybe flat file could see a revival?

A filesystem is a database. It store information. You can retrieve information. You can update information. Modern filesystems support locking and transaction logs to recover from failures.

incrediBILL

6:10 pm on Feb 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



if you're only talking 8 special offers, meaning 8 database entries, or 8 lines of text, the flat file performance will blow the pants of a MySQL query. Even the old xBase (dBase) databases like CodeBase by Sequiter Software will blow the barn doors off most SQL systems for relatively small databases as long as you don't need joins it's fantastic.

ahmedtheking

11:30 am on Feb 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Man this all seems so crazy!

Ive decided to just add the special offers into a text file and use explode(); to seperate the special offers!

Thanks for the help!