Flat File Database System?
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?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Flat File Database
I'm making a flat file database script right now and I need to know if there's a certain limit of characters that can be reached so that the information is written onto the next line. For example if I had this text file: hello hello hello hello hello hello hello hello hello hello If I kept writing "hello", is there a certain limit where hello will go to the next line? Because I'm storing each set of information on it's own line, I don't want one of them to become too long and go onto the next line and mess up the database.
Flat File Database
I am making a simple content management system that allows the users to change the basic text on the page and insert new Articles. This will mean having a simple database with a table for page content and a table for Articles. This will be a flat file system. I was woundering if this is a bad design and should i create a database with normalised? I will be using php and mysql to grab the information from the database to display it on my web page.
Database Or Flat File Based?
I'm writing a news script, where I can write articles and have them outputted on my homepage. What I'm wondering before I start is; does anyone have any advice whether something like this would be better of stored in a database or flat files? Some articles could be quite long and I just thought they may be better suited stored in a .txt file for instance, but then again it might not make any difference.
Converting Flat File To Database
I have a script that looks in a flat text file for an image and coordinates, then plots them on Google Maps in a DIV tooltip. I want to convert the script to database but need to know how it works in order to do so (mainly when there is 2 or more pictures under the same coordinates it will group them in the same DIV and not loads over lapping each other). Code:
Deleting Not Working - Flat File Database
I have to decrypt the $email variable in order to delete from a flat file database. I am not sure how to do this... It decrypts it and trims it to display on a select field, but I don't know how to make it delete. Code:
Flat File Database Image Gallery
I don't have a database available, so i'm writing an Image Gallery with a flat file database. I have an Add Page: Uploads Image file, and saves $filename and $caption to text file: captions.txt Captions.txt is in format: photofilename.jpg|caption to do with photo here. I can easily read out each individual part from the captions.txt file to display the photo and caption on a display page. I also have a delete file that unlinks the photo, using the info in the captions.txt file, but i can't figure out how to remove the entire line from the database file based on the filename...??? Basically I want to click on an image like this: <a href=delete.php?filename=phototodelete.jpg> and have the delete.php file unlink the picture, and then erase the line in the text file, that begins with the filename (phototodelete.jpg). I guess i need to search through the data file and when i match the filename, erase the line...
PHP Flat File Database - How To Load And Edit Lines?
I am using a text file as a database, each field delimited by || I want to be able to print all lines to a page, then by selecting one (with, say, a radio button) it will load into the form at the bottom of the page, where I can edit the fields, and save back to the same line in the text file. I dont know how to use primary keys or anything with a text file database,
My Script Pauses - No Calls To Database Or File System - But A Long Pause
There is a point in rendering a page of mine where my script pauses for a long time. It is a painful wait - maybe 5 seconds. It is long enough that when I try to show the software to people they get bored at that point and begin to look away. I'd like to remove whatever road block slows things down at that point in my script, but I am unable to diagnose the problem. I am using a command that is used elsewhere on the page, before and after, without delays. There are no calls to the database or the file system.
Help? How To Create Next Buttons When Using A Flat Text Database
Ok, I know the code below does not work but I am wondering about the logic... 1 How do I just print 10 rows. 2 How do I get the buttons. You get the Idea. Anyway, I would like to know if anyone has done this with text files. I always see mysql as examples but nothing using a flat text database. <? $maxResults = 10; $datafile = "sometextfile.txt"; $rows = @file($datafile); for($size=0;$size<count($rows);$size++) { $rows[$size] = chop($rows[$size]); $coll = split("|",$rows[$size]); // print something } if ($size > 0) { $currPage = $size / $maxResults; if ($currPage > 1) print("<A HREF="test.php" >['prev']</A>"); for ($i = 0; $i < $size / $maxResults; $i++) { if ($currPage == $i + 1) printf("<A HREF="test.php"> </A> ",$i + 1); else printf("<A HREF="test.php"> </A> ",$i + 1); } if ($currPage < size / $maxResults) print("<A HREF="test.php">['next']</A>); } ?>
How To Limit Output Lines Per Page Using A Flat Txt Database
I searched the boards for some direction in limiting the output to so many lines like "Back 1 2 3 Next". However, everything is pointing to mysql databases. Has any one did it with a flat text file? This is a sample of how I print to the screen How can I modify this? PHP Code:
Exporting DB Results (or Flat File) To An Excel File
I have two scripts, neither of which have been written, that will need to collect user information. They will either write to a flat file or to a MySQL DB, and I need a way for an administrator to grab an Excel file based on this data. First, no more than 100 people are expected to sign up, so flat file is certainly viable. Do you recommend I use DB or flat file? Second, based on your recommendation, how should I go about exporting the user data to an Excel file? There will be about ten form fields per registration to give you an idea.
Flat File
I run a website for a small (very small) AM radio station. I need to add a page where listener's (all seven of them) can list items for sale. (This will be the online version of a daily call-in "For Sale" show that the station runs.) The station owner wants the listings to disappear automatically after 3 days. My current plan is to let the visitor enter info on a form: telephone no. and item description. The form will tack on a timestamp and then append the data to the target file. When displaying the data, I need to: 1. Only display data less than 3 days old and... 2. Delete from the file data more than 3 days old. I'm thinking of having the display page read the file into an array and compare timestamps to a standard. Those that pass are copied into a temporary file. When the entire array has been checked, the temp file is written over the original target file. The temp file is discarded and the new, most current version of the target file is displayed on screen. Does this seem like a reasonably logical way to do this? I looked at the PHP manual and didn't see a command that removes single entries from a flat file, so this is the approach I came up with. But perhaps I missed something? I'm using a flat file because I don't anticipate ever having more than just a handful of entries at a time. (I also just want the practice with flat files; I haven't used them as much as I have relational databases.) A couple of other notes: Users will not have to have a password or anything like that. They'll just post and the item will stay on the board for three days, as per the station owner's wishes. The system is being kept simple in part because the owner believes that most of the listeners are elderly and (in his estimation) not super computer types.
Flat File
I know this is a total noob question but im just getting into flat file scripts because a friend of mine has a site that does not have a database. so i told him ill try making him a news script made with flatfile so he doesn't have to switch hosts.. but my question is.. is there a way to delete data thats in flatfile? like set them in an array or something?
Counting In A Flat File
Has anybody an idea, how I can count especially some records (e.g. different category) in a flat file? My script only counts the complete lines of the file ... $count = 15; $content = file($conf[myDataFile]); $size = count($content); ... I want to count each recorset that has the same value (e.g. category) like the querystring ($cat) Therefore I have to define the number of the field in the flat file. ... ($myLINES[$i][13]==$cat); ...
Flat File Web Stats In PHP
I'm looking for a basic web stats script that will allow me to count hits, time and where user goes, as well as browser and OS if possible.. I want to be able to customize it into my template... anybody know of something prewritten that i can customize?
New Line On The Flat File
i recently decided to code an extreamly simple php cms which i can use on any websites i make. so far i have made an input form, a procesing page, a flat file, and an index with an explode function which shows the last 5 posts newest to oldest. all of it works up to a point. the problem i have come accross is that when you fill in the message part of the form if you press enter to give a new paragraph it creates a new line on the flat file which the script then thinks is a new line of arrays which makes each new paragraph a new post adding it above its proper post. i wonder if its possible to somehow stop the line break in the textarea counting as one in the flatfile.. or even better if i can replace it with a < br> tag so it shows as a new paragraph.
New Line In A Flat File?!?!
Made a simple script that can add, edit, or delete objects in a flat file. To use for news, simple ecom, etc. Created the script and tested in on one server and worked perfect. Just moved it to the actual server it will stay on and for some reason what used to make a new line for a new object just adds an upright looking rectangle looking symbol. Sorry can't copy it here cause it won't show up; will only show up in notepad. Once the symbol is added it will add the new data in the same line is the last object in the flat file. Anyone have any thoughts?!?!?! Code:
Flat File Code Generator
I want to know how I can add breaks between table elements (html code) when it's generated from a flat file (input forms) ? Right now the code appears in one continous string, and I'd like it to be neat and tidy (breaking in the code after </td></tr> and </table>) Is this possible? Here's teh code, to show you what I mean : http://stage.jpauldesign.com/mctl/h.../viewevents.php
PHP Flat File Vs DB For A Small Website
I'm having trouble deciding on whether to go with a flat file or DB driven architecture for a wee personal website. I'd like to be able to update HTML files online and this is my only requirement. Flat Files: advantage: attach some PHP code at the top of each file that allows the file to be opened and edited disadvantage: the files would have to be writeable DB: advantage: more secure disadvantage: allot of overhead Would anyone have any advice? PS: I was originally planning to use a CMS but found that no CMS was customizable enough with little effort for a basic small website - strang eh :)
Delete Flat File Content
Just have a basic notes.txt to which notes are obviously added to. However, i would like a page "delete.php" to have all content within that file deleted, but keep the notes.txt file intact.
DB -> Flat File, Did I Waste My Time?
In my site I have a config table, (MySQL), with about 30 entries; the data is loaded on every single page load. This is not the only call to the db, (we do a total of about 8 calls to the db). As with many configurations settings, once the options are set the values will not change much. So I thought it would be a good idea to move the data to a flat file. I have written a small wrapper class to first look for the file, if it exists then load the data from that file, if not the data is loaded from the database and then saved to a file. That way I can copy the database without worries about the cached data itself. It all works as expected, but the question is, did I waste my time? How can I do some load test on my server to see what would be better? Database call or flat file read.
Replacing A Record In A Flat File
I am trying to replace a single record in a flat file. The file is relatively small and no need for database. I open the file, and save the ftell() value in a variable. I read a record using fgetcsv(), modify the index contents it if/as necessary. I then position the pointer back to the beginning of that record using fseek(value_from_ftell). I build a new string with the required delimiters. Finally I put the record with fputs() (also fails with fwrite()). What the code actually does, is append a NEW record to the end. Can't seem to find out hot to REPLACE the original record with the new data. Code: --------- $fp = fopen('filename'); $filerec = ftell($fp); -->for...next $user = fgetcsv($fp, 999, " "); /* Code here to change as required $user[0-6] */ $outputstr = $user[0]." ".$user[1]." ". etc, etc fseek($filerec); fputs($fp, $outputstr); -->next fclose($fp);
Deleting Lines From Flat File
I am trying to display all the news items in my flat file with 'delete' links (<a href="managedeletenews.php?action=delete&id=$key">Delete[/url]) that call the same page to strip out the line and rewrite the file. However, when the delete link is clicked nothing happens (except the page's address changing from "managedeletenews.php" to the above. Am I using the references to the $id or $key variables incorrectly? Is it something to do with the undefined $action variable? Or is it something else?? BTW, the embedded styles for the delete link - shown below - don't seem to be throwing up any errors. Code:
Using A Flat File For Large Queries.
I have 13 rows of information, and instead of storing that little amount of data in the database, I figured I should save some storage and put the information in a flat file instead. Lets say my flat file looks like this: Account type (int) | amount (int)| more info Account type (int) | amount (int)| more info Account type (int) | amount (int)| more info Lets say my database table looks like this and there are about 5,000 rows. UserID Account_type Would it be insane to loop through the flat file for each individual DB entry and find the matching "account type" for that individual user, then add the "amount" field to a row in the DB according to what account type they have? Or would this be a lot easier if I just stored the flat file information in a table in the database?
Displaying Data From A Flat File?
ive got a flatfile database sorted out, all i need now is how to store individual flat files per user and how to paginate that data. Just to make sure i'm doing everything right, i'll post the code below Code:
Flat File And Passing Data
I am currently working on a project whereby users login to my website (which is working) and then using a form add new links/tabs to their navigation bar (which i need help developing). So for instance if the user had 'home/search engines/favourites' as links on their navigation bar and they wanted to add auction sites as a group title they fill out the form which wants the name of the link and the URL it goes to. So far i can make the form send the link name and URL to my flat file database (usertabs.txt) but i also need the form to once submitted automatically insert the users username before the link and URL to make their new link unique to them. So in the flat file the structure will be: username|Link name|URL The usernames etc are stored in a separate .txt file. I have this code so far which is the basis for uploading new links to a users navigation bar. $userid is the variable i want to be associated with the user who is logged on. Code:
Flat File Display <i>x</i> Number Of Lines
I have a "site updates" script that I wrote that stores my site updates in a flat file in the form: 21234123|>|blah blah blah 21234123|>|blah blah blah 21234123|>|blah blah blah where 21234123 is a unix timestamp. what I want, is to be able to display the last x updates on my main page. I have a "updates.php" page which displays ALL updates... but I want to display just the say... most recent 3 or 5 updates at the bottom of my main page. This is my function that displays -all- updates.
PHP Flat File Search Engine (a La Lucene)
Wonder if someone could help me. I'm looking for a PHP/MySQL based search engine that can search flat files i.e. build it's own index from flat files. I've used Apaches' Lucene before (http://jakarta.apache.org/lucene/docs/index.html), so I'm looking for something similar. If there's a pay-for product out there, I don'd mind paying. So, it needs: - Ability to search a set of flat files and build an index - Allow users to enter BOOLEAN operators, e.g. dog AND cat OR donkey - Return results on an accuracy match basis e.g. no. of times all words in search phrase occured in a file/record
Reading Flat File Information Into Arrays
1. I have a form that wirtes to a flat text file when it is submitted. The form allows you to input up to 3 stories - each with a headline, date and the body copy. I am writing the information to a flat text file. 2. I want to read this flat file into another page and have it know that the first entry is the headline, the second entry is the date and the third entry is the body copy and do this for as many stories that have been input. I am thinking the best way to do this is to use some sort of loop and an array but don't know how to set this up.
How To Sort A Flat Text File By A Particular Field
I have created a flat file database to store contact information on my friends. The fields are 'firstname', 'surname', 'job title', 'address' etc What I am trying to do is be able to display a sorted list of my friends based on a particular field eg 'sort by surname'or 'sort by address' etc Each row in the file ends with a '' and each field in each row is separated by a ' '. I have come to the conclusion that I need to use the array_multisort function but cannot find any examples of taking information from a flatfile database and using array_multisort to sort and display based on a particular field. This is how far I have got but I am now stuck as to where to go from here? I have read the php manuals but it does not appear to improve my understanding of what needs to be done. Code:
Reading/comparing Vars In A Flat File
I am trying to read info that has been written to a flat file, search for a particular variable, and then compare it to existing ones to make sure there isn't a duplicate entry written to it.Ex. 1. Users fill out a form (including username and password) 2. Upon submission they are taken to another page which displays info they just entered so they can verify. 3. After they okay the info and click, they are taken to page four which emails them and writes the info to a flat file. What I want is a way to be able to iterate through the info written to the file and compare the 'username' that the person picked to existing ones. If there is a duplicate, then force them to choose another. This is what I came up with. I get no errors, but it doesn't work... PHP Code:
Help Debugging Flat File Picture Gallery
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in displaying them on the delete page. you can see it in action at www.4am.com.au/gallery/upload.php - read.php - delete.php. You can download the source at www.patoncreative.com.au/gallery.zip, and I have posted it here below... i would appreciate some help in debugging it.. i'm not the best with the 'foolproofing' of it before putting it into use. UPLOAD.PHP######################################## # <form action="upload.php" method="post" enctype="multipart/form-data"> Select a Photo to Upload:<br> <input type="file" name="filetoupload" size=཮' class='form'><br><br> Enter Photo Caption:<br> <input type="text" name="caption" size=཮' class='form'><br> <input type="hidden" name="MAX_FILE_SIZE" value="<?echo $size_bytes; ?>"> <br> <input type="Submit" value="Upload File" class='form'> </form> <br><br> <?php /* Description ----------------------------------------------------- The Super Global Variable $_FILES is used in PHP 4.x.x. $_FILES['upload']['size'] ==> Get the Size of the File in Bytes. $_FILES['upload']['tmp_name'] ==> Returns the Temporary Name of the File. $_FILES['upload']['name'] ==> Returns the Actual Name of the File. $_FILES['upload']['type'] ==> Returns the Type of the File. So if I filetoupload the file 'test.doc', the $_FILES['upload']['name'] would be 'phptut.doc' and $_FILES['upload']['type'] would be 'application/msword'. ---------------------------------------------------------------------*/
Sorting News Alphabetically (flat File)
I need som help sorting news alphabetically. I use the explode function to get the contents. And the while() function. Basically, I explode the "|" sign and I want to be able to sort any "|" row alphabetically. Somebody have a clue ??
Flat File List Style Menu
I'm trying to build a Menu Building out of flatfiling with a section to add new areas to it. The idea behind it is to have a header for each section (as the top order list item) then each one below is a link of that category. I already figured I'm buillding it with limits (20 items Max per heading) and that to do it I will simply have each Heading/links in it be a new row in the document. example row Tips tips.php Tips on Php, file tips File Tips tips/files.php, etc etc With the first item of each row being the Heading and each other being the ones under it My question is What delimiters should I use to seperate in the row (I need to separate each item by 1 delimiter and then in each row separate the href, alt, name) Secondly for rewrtiign it should I simply write it so each time it rewrites the whole file or should I try and do string replacing and do modify sorta deal.
Logged In Users, Sessions And Flat File .txt
I am currently working on a project whereby users login to my website and then using a form add new quick links/tabs to their navigation bar. So for instance if the user had 'home/search engines/favourites' as links on their navigation bar and they wanted to add auction sites as a group link they fill out the form which then posts the data into a flat file database. (usertabs.txt) So far i can make the form send the link name, URL and attach the username of the person adding links so to make a id for the link name and URL. So in the flat file the structure is presently: Code:
Deleting Strings Of Data In Flat File Db
I have a flat file database with some data stored in it. I have a script which uploads new data to it and want to have a script where by i can delete specific rows of data. I have a 'delete' link which when clicked is meant to delete that specific row of data which works when each columb of data is a single word with no spaces but when i have strings of data it won't delete.
Pulling Date-specific Data From Flat File
I'm almost a complete newbie to using PHP and I was hoping one of you guys can point me in the right direction. I'm working on a site for a brand of handmade fruit juice and it only needs one bit of dynamic content: the info on what fruit is in the juice and where it is coming from (vendor, country etc.) today and tomorrow (the content of the juice is different everyday). So I thought it would be easiest to put that information in a flat file (an Excel file would be ideal but a plain text would do too) on a weekly basis and try to pull out the needed info with PHP. Except I don't know how yet. I don't expect any of you to do the work for me but if someone could point me to which functions of PHP I should do some research on, I'd be most grateful.
Site Stats, Php/mysql OR Flat Text File?
I'm have a cms and I want site stats built in, thus apache's stats or cpanel etc don't cut it for multiple users. I have a working stat query below, the problem is, in a short time 12 hours, it's grown to 109k with 500 records. now I'm not adding a row for every person, I create a session, and if they already have a row, I update clicks (page clicks) as you can see. still, it's big, the bots are eating it, so I figure, why not just create a separate table for bots, with 1 row per day and a click count. there, smaller. but with multiple users, and lots of normal hits, this will still grow quite large very fast! so I'm wondering if flat text files would be a better solution? but perhaps opening and writing to a text file constantly gets very slow? I'm confused. Code:
Flood Protection Scripts That Uses Flat File Databases?
Does anyone know of any php flood protection scripts that use a flat file database rather than mysql, and if so could you provide the link to it or something please? I found a free flood protection class, but it uses mysql, i was wondering, is it possible for flat file database to remove an ip after a period of time, as can be done with mysql? Code:
Importing A Flat Pipe Delimited File Into A MySQL Data Table
I have done this in perl but eeew I don't want to use perl anymore. I want to be able to take a flat file that looks like this: mbriones@...|Marian|Briones bobsmith@...|Bob|Smith janedoe@...|Jane|Doe (etc) The table has more than 3 fields, so I'd want to process the flat file and then do an INSERT into mailinglist SET field=$value for each line. Does someone have a nice way for me to do this? The flat file will be uploaded to the server via a form (copy) and then be processed.
Database Rating System
Can someone point me in the direction of a PHP Rating System I can use on my site, that incorporates a MySQL database, so members of my forums can rate certain content on certain pages? I have no experience in coding, but if a tutorial is available I can modify the coding.
Using System/exec, How To Backup Database?
system("mysqldump --opt myDatabase > backup.sql"); here are my problems, i don't think it works on the webserver. next, where exactly the file, backup.sql be place if it does succeed. i believe we just can't execute commands on the webserver can we? i also tried using the sql query BACKUP TABLE ... TO .. but i'm guessing the problem lies with the TO... how do i know what directory shall i place it therE? for instance, my pages are placed in, home/myname/public_html/... i tried to put home/myname/public_html/backup in the TO but nothing happens.
Comment System Database Structure
I'm sure this has been brought up numerous times in the past, but I couldn't find any posts asking it specifically. I am creating a comment system for a news site.. and my question is: does it make more sense to have one table containing all comments relating to all stories, calling the comments by story ID, or to create an individual table for each story containing just the comments specific to that story?
Content Management System Using Backend Database
Can I ask some advice in regards database solutions and content management solutions.? Do you have a philosophy on what is the best for databases - ASP, JSP, Cold fusion, PHP, etc. My company website site is going to be rebuilt and I am the lucky one to do this but I am unsure of the needs and complexity of the project, and what would be the best base code. Do you have any thoughts in this area? The site requires functionality like display projects, archive projects, sort projects by date, project location, group company, etc. All images and pdfs are currently uploaded through the content management solution, however we will have to implement a new content management solution as well. Do you know of an easy to use product that functionally work well in content management? Do you know of any products on the market that are like WYSIWYG database solutions?
Server File System
usually with cgi scripts they are kept outside of the htdocs directory for security and are in a directory with only executable permissions. how does php relate to this? - where should they be stored and with what permissions? could someone please point me to some good online material covering these issues.
|