SyntaxPro Posted November 27, 2010 Share Posted November 27, 2010 Hi, I use MySQL for real projects of course... but, I like to challenge myself and I was wondering how people make advance applications with Flat File databases... My questions are... >Display >Reading The Flat File Data >Sorting it Alphabetically For Display >How to create a WHERE clause affect with the data >Storage >Adding Records >Deleting Records >Editing Records I went over a lot of this on my own, but I'm stuck on certain parts because google only has so much on Flat File Databases... also how would u secure a Flat File Database from someone just simply direct linking to it and viewing it? Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/ Share on other sites More sharing options...
requinix Posted November 27, 2010 Share Posted November 27, 2010 Reading: easy, just read the file. The rest depends on how the stuff is stored (eg, in XML, CSV, plain text...) Sorting: either the file is sorted already or you have to read the entire thing into memory and sort it there. Where: complicated, depends on how powerful you want it to be - basically, read each data item and apply the conditions. Adding: if the file is sorted, read the whole thing into memory and insert the new stuff where it belongs; otherwise just append to the file. Deleting: read the whole thing into memory, delete, and write it all back out. Editing: read the whole thing into memory, edit, and write it all back out. a) Flat files themselves are simple; what you're writing is the database management system. b) No, real database systems are smarter than that. There's not much "read the whole thing into memory" because the "flat files" are better structured. How all that stuff works is beyond the scope of a PHP forum (and even many database forums). Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/#findComment-1140246 Share on other sites More sharing options...
JasonLewis Posted November 27, 2010 Share Posted November 27, 2010 Google should have quite a sufficient amount of information on using flat file. In regards to your last point, obviously these files aren't going to be as secure as a database. Best bet is to place the files outside of the main directory structure of your website (not in public_html or www) to prevent users from accessing them. Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/#findComment-1140264 Share on other sites More sharing options...
SyntaxPro Posted November 27, 2010 Author Share Posted November 27, 2010 Thanks for the help! One last question... lets say u have $test[0] = array("Shane","19","Wisconsin"); $test[1] = array("Ricky","18","Wisconsin"); i know thats probably not right syntax i was just getting the point out... how would i sort that alphabetically by the first name? Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/#findComment-1140276 Share on other sites More sharing options...
litebearer Posted November 27, 2010 Share Posted November 27, 2010 This may help... http://www.informit.com/articles/article.aspx?p=341245&seqNum=7 Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/#findComment-1140297 Share on other sites More sharing options...
SyntaxPro Posted November 27, 2010 Author Share Posted November 27, 2010 Thanks everyone, after searching google, and reading ur notes... I figured out all the parts of a flat file database... now to move on to something else lol Link to comment https://forums.phpfreaks.com/topic/219970-flat-file-database/#findComment-1140424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.