zubrag.com
Free php and cpanel scripts to automate your daily routine

Free PHP Scripts :: Flat File Database Manager

A flat file is a file that contains records. Each record is specified in a single line. Fields from each record may either have a fixed width, or may be delimited by commas (CSV), tube (|), whitespace, tabs, or any other character.

Flat File Database Manager will allow you to manage (update/delete/add) records in your flatfile database.
Note: Currently flat files of fixed field width are not supported.

Features:
  • user defined delimiter (usually pipe, colon, or comma (|:,)
  • customizable presentation of different data types. Following data types supported:
    • LIST - Rendered as list box or combo box.
    • STRING - Rendered as regular input field.
    • LOGICAL - Rendered as check box (flag).
    • TEXT - Rendered as text area.


Flat File Database Manager screenshot

What is in the package?
1) cities.txt - database itself, i.e. file containing data. Sample database.
2) cities.def - data definition file, describes database (how long each field can be, its type, etc). Update it.
3) cities.php - database settings file (delimiter, file names, etc). Update it. See instructions in the flatfile.inc.php. Run this script to manage your db.
4) flatfile.inc.php - flatfile db manager engine. This file should not be updated.

Download Flat File Database Manager


Comments

Flatfile database user October 4, 2007
My flatfile databse is about 500K. Loading on IE took few seconds. Loading on Firefox took about a minute. I wish firefox was faster. Thanks for the script!
PS: please add reporting or data filtering capabilities.
Girish Singh April 4, 2008
I was looking for flat file database to use on website where the host could not support a database.

Another page which I found useful was

http://www.mabaloo.com/Web-Development/Building-a-fully-function-website-but-without-a-DATABASE.html
k.bahadur673 [anti-spam] gmail.com May 3, 2008
its a very good work done by you people
July 21, 2008
Fantastic work guys, this makes things a lot less bulky for me. Just needed flash to load some values and rather than connect to a SQL server, I can get it from a structured txt. Grade A+++
November 6, 2008
What happens if numerous users edit and save the CSV at the same time ? I wonder what would happen if their changes where saved.
March 1, 2009
Great!!! - something that can be customised easy by a PHP newbie - thanks, much appreciated lads ;-) for all your work
March 9, 2009
Very nice script. Is it also possible to add something like a date field. (DATE iso STRING)?
jj March 10, 2009
Interesting approach...
cj [anti-spam] cjluck.com April 12, 2009
I really like this script. I use it to make simple online signup sheets for prayer events.
Damoon April 18, 2009
What of if i want use it for a chatting site or dating site , will it support it????
kkk August 11, 2009
kkkk
Zante September 4, 2009
Needs a way to shift records up and down. Currently the only way to do it is by editing the txt files.
aleks [anti-spam] motor-racing.net September 21, 2009
Hi, Great script, how can i limit the number of row to 7 or 8 with no add or delete of rows.

thanks ak
October 2, 2009
HI. If anyone needs it, this script will make the data in the defined file into a muti-demesinal array

<pre>
<?php
$file = "test.txt";
$config = array();
$config1 = file_get_contents($file);
$config2 = explode("\n",$config1);
//print_r($config2);
?>
<?php
$num;
foreach ($config2 as $i) {
$num++;
}
for ($i=0;$i<$num-1;$i++) {
$config3 = explode(":",$config2[$i]);
//print_r($config3);
?>
<?php
$name = $config3[0];
$value = $config3[1];
$config[$name] = $value;
}
?>

See in action at
http://67.220.215.115/ffdm.php
bundyxc November 29, 2009
"My flatfile databse is about 500K. Loading on IE took few seconds. Loading on Firefox took about a minute. I wish firefox was faster. Thanks for the script!
PS: please add reporting or data filtering capabilities."

Seeing as how this is processed server-side (hence the PHP), I honestly doubt that Firefox is your problem. And if it is your problem, I'm sure that sometime is going wrong for your computer.
fastidioso [anti-spam] altervista.org January 21, 2010
Hello, congratulations for the excellent script!
I wanted to know how can I put in the file flatfile.inc.php function sendmail, to send email to any modification.

examples:
Content-type. */
$Subject = "test\r\n";
$Body = "<a href=\"http://mysite.com/$data_file\">test</a>";
$intestazioni = "MIME-Version: 1.0\r\n";
$intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n";

$intestazioni .= "To: email@email.it\r\n";
$intestazioni .= "From: email@email.it\r\n";
$intestazioni .= "Cc: email@email.it\r\n";
$intestazioni .= "Bcc: email@email.it\r\n";

// send email
$success = mail($Subject, $Body, $intestazioni);

Thanks
marek February 27, 2010
oh yea, this freakin thing DOESN"T WORK!
April 6, 2010
Looking for 2 days, and than, yeeaahh! This is what i need! Great job!

Thanks,

Anthony.
Paul June 3, 2010
Hmmm... I generally like the scripts here but this one seems not to work if you have Plesk installed. There's a comment about that on the forum - from some time ago, but there was no fix noted and the problem seems to persist with the current version.
BryGee June 3, 2010
Brilliant Zube

I can now add and edit Youtube Movies in a breeze http://lincolnnational.co.uk/=movies=/

Works ok but getting some Notice: Undefined offset: errors on localhost


feedback appreciated
clifford_fairchild [anti-spam] yahoo.com July 11, 2010
CAUTION: No single or double quotes or periods in the field definitions!
Brian Brown
http://rant.brianbrown.net
http://search.brianbrown.net
August 3, 2010
Thanks for the script. Simple, straight forward and versatile. Job well done!!!!
Fred December 5, 2010
(I tried posting this in the forum, but it wouldn't work)
First, let me say how much I love the Flatfile Database script! Great Job ;D

Something that would be nice to have is the ability to choose an image as an option, rather than just text.

For instance; say the option is LOGICAL (checkmark). If the box is checked, to show an image of an actual "green checkmark", and if it's off it would display a "red circle" for example.

(or point to an image from within the server in order to avoid using an outside link) some may not like having their images used without permission.

I managed to do something with the .def and .txt files without doing any reprogramming of the script itself, as I am not a "programmer" but able to get around scripts fairly well.

If anyone knows how to do this, it would be very very nice indeed!!

~Thank you~
louisjms [anti-spam] yahoo.fr July 30, 2011
im looking for help! i have a serious problem. i dont know how to store data in text file(flat file) and to display data to the browser.those steps give me headech.please if someone can help me,ill be gratefull.thanks
swaponmmr [anti-spam] yahoo.com November 26, 2011
Its good. Thanks.
mujfibi [anti-spam] gmail.com December 17, 2011
Good work ;-)
June 16, 2012
Thanks, great job!
If you are trying this on puppy linux,you may have to copy files from usb or disk to webroot and then chmod if you have permission problems.
Richard August 18, 2012
Is there a way to INSERT line between two existing lines. If it had that one feature it would be PERFECT!!!!!
Greg Swofford December 17, 2013
Great code. Setting up a flatfile couldn't be easier. THANKS
Bloke April 2, 2015
If you go directly to the yourdomain.com/folder/flatfile.inc.php file you will see a bunch of php errors but worse anyone can click the big grey button and delete all your members info. No login required. I've not been able to fix this without breaking something else. It's a possible deal breaker. Any thoughts?
April 2, 2015
Put a password on it using Web Page Password Protect script from this site.
April 2, 2015
that's not a fix though, just a hide, a fix would be sensible
aleks [anti-spam] hanga47.uk September 1, 2015
Hi, great script been using it for years, since 2009 i think.
i have a small problem it will only aloow upto 34 records, how do i increase this?
steveparadisdesign [anti-spam] gmail.com September 30, 2015
Can flash write directly to it? If so what would be the call. It is for a scoring system. Keep track of player scores, their names, levels...etc
wahyuskull22 [anti-spam] gmail.com June 1, 2017
wahyu tamvan
ybhask [anti-spam] gmail.com August 3, 2017
Text files with ^ as record (row) separator, and a`, b`, c` ...z` as field separator (not delimiters) we can easily manage data with thousands of records. No need of databases or tables. For accessing fields we have to use split, delimiter ^, stripos, substr, str_istr etc php given functions.
bob May 12, 2019
hello