Delete From Flat File Database ?
I have recently started to code a Flat file database (just for fun) and it's going fine, but I was wondering whats the best way to delete a line from the file.
I have this code below and I would like to add a delete button besides each line, which would obviously delete that line. But I do not know the best way to go around doing this as I don't know any specific functions to use. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Flat File Delete Row
Does anyone know how to delete just a single row in a flat file database using php? The "w" function deletes the whole file. Is there a tutorial anyone knows about with examples of this?
View Replies !
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.
View Replies !
Delete A Line From A Flat File
I have a flat file database with 5 columns. It's basically an file with a load of email details, with the last columns having three different values. How would I go about searching and deleting the a line from it?
View Replies !
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.
View Replies !
Flat File Or Database
I have a PHP script that I created as Open Source. At the current time all configuration and setting options are in the configuration file. Would it be more logical - or better - to just have database settings in the configuration file, and all other settings stored in the database? What is the most common method?
View Replies !
Database Or Flat File
I am coding a chat script right now and I was wondering if it is better to use a MySQL database for the chat messages or to use flat file performance wise. I will be polling for new messages every second so a little performance improvement goes a long way.
View Replies !
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 Replies !
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.
View Replies !
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:
View Replies !
Edit Flat File Database
I am looking to edit a record set in a flat file database. The user clicks on a link with an id to the page events_edit.php. I am trying to have it so that it can get all the information related to that id and then I can put it into the value="" field in the html. I Will then have to work out how to make it update.
View Replies !
Simple Flat-file Php Database
I'm looking for a simple,web-enabled php database that I can customize. It doesn't even have to use mysql.It's just gotta be able to hold about 200 records,and each record has five fields. It should have some mechanism to avoid overwrites when two or more people are adding data. Ideally, it would store the data as comma-delimited text that I could later import into excel. I realize there must be a bazillion apps like this out there, but I'm having a hard time figuring out the category/keywords to offer up to the Google oracle.
View Replies !
Search Through A Flat File Database
I am trying to write some code to search through a flat file db. It's just a very simple thing: date¦name¦e-mail¦IP¦comments All I need is a snippet that will return a list of entries that match the keyword/s I submit... I know: mysql bla bla bla... But I want to stick to flat files for this. Try as I might, I just can't understand how to do it. Can someone point me to some on-topic tutorials or scripts? Tutorials would be best, since I'd like to actually learn how-to, rather than just copy&paste. But scripts are also OK if you do some reverse engineering.
View Replies !
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:
View Replies !
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...
View Replies !
Backup My Mysql Database To A Flat File
I have been browsing all over the internet, and searching for ways to backup my mysql database to a flat file however; all the scripts I find either just backup the data and not the structure or backup both but it only works if your hosting the db on your machine. Is there a script out there or a tutorial ANYWHERE that tells you how to backup your mysql's database structure and data?
View Replies !
Finding The Next Date In A Flat File Database
I have a flatfile database (can't use mySQL, sorry!) which holds information on up and coming events, in the format: 08 October 2005*Glasgow Match*Home* 15 October 2005*Liverpool Match*Home* 22 October 2005*Manchester Match*Away* 29 October 2005*London Match*Home* 06 January 2006*Newcastle Match*Away* I have searched everywhere here (honestly) and elsewhere but can't find a solution to this problem: I am trying to write a php script that will look at today's date (the date the page was accessed) and the look at the above file and calculate the next match and output that data. Code:
View Replies !
Using A Flat Text File As A Mini Database
I wanted to know if instead of using mysql, would starting off with being able to save data to a flat text file be as easy or easier? I know its not as featureful, but me personally I kinda find using a flat file better in some ways , anyways if I wanted to get into this what should I research for php using flat text files for storage?
View Replies !
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,
View Replies !
Extracting Info From Files In A Flat File Database
I am in dire need of a script that can read the variable files from within a file (ie: client_01.inc). I already know about the include() and require() commands, but I want a table with a script that points to a directory of files. I have client files each with variables in each file and the table needs to extract the info from each file in that directory to display in the table. Code:
View Replies !
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>); } ?>
View Replies !
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.
View Replies !
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.
View Replies !
Flat-file Cms:
help with a cms I am making, i cant figure out how to make the old news go down and put the newest news at the top. <?PHP $time = date("F jS Y, h:iA"); $name = $_POST["name"]; $title = $_POST["title"]; $text = $_POST["text"]; $data = fopen('show_news2.php', "w+"); fwrite($data, "<center><strong>$title</strong></center><br/> $text <br/> <center><em>Posted by: $name, on $time</em></center><br/><br/>"); fclose($data); echo 'News Updated, <a href="http://tackypenguin.com/index.php">Home page</a>, or go <a href="index.php">Back</a>' ?> thats what i have so far
View Replies !
About Flat File And
I'm working on a little blog based on flat files. The rows are separeted in this way: field1." ".field2." ".field3." " the great headache is: if magic_quotes_gpc is ON become or not ?I mean if the code is: list($value1,$value2,$value3) =explode(" ",$row) or rtrim($row) I get into troubles or not ? Greetings from Italy.
View Replies !
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); ...
View Replies !
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?
View Replies !
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.
View Replies !
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:
View Replies !
SMS Messages Using Flat File
I have a code which allows a user A to send an SMS to user B. User B recieves the message and user A gets a confirmation. This part is ok and works well. Where i need you. I would like user A to not always get the same confirmation messages, instead a different message with every SMS sent, like quatations. I do not have a database and seek advice on how i can do it with a flat file. Is is possible?
View Replies !
Reading From Flat File
I'm trying to write a script to calculate my hours for work. I have a text file with my hours written down as a timestamp.. 11:40 01/04/2007 13:30 01/04/2007 19:30 01/04/2007 19:40 01/04/2007 21:10 01/04/2007 00:15 01/04/2007 Basically the first line is my start time the one below is when I finish. Each work block is broken up by an empty line. I've never tried a file based system before as I've always used databases, but I'm wanting to use a flat file system for this. Code:
View Replies !
Databae/flat File
I have a MySql database and a piece of code to read and process information from that database. If I want to pu this database and its information onto a cd or dvd, how can it be done. Or mayabe I should ask can it be done and what is the best way/format to do it. For example, say I had a simple guestbook actually on the web and I wanted to keep that information on a cd what is the best way to do it. I dont need to be able to add any more entries to the database, just read what is there already.
View Replies !
Writing To Flat File
I am looking for some code to enable me to export the data in my table into a flat text file (.txt). The table has 6 columns and about 50 entries in it.
View Replies !
Flat File Conversion?
I have a space delimited file that I need to do a little manipulation of an then convert to a comma separated file. I have the conversion working alright, but I'm not sure of the manipulation? Code:
View Replies !
Best Way To Read In A Flat File DB?
I am writting a script that needs to read in a rather large flat file database (.txt). It is about 300k and contains approx 15,000 records (ie lines) I was going to simply use include() $db = include("flat-file.txt"); And then word with $db. However, is there a better way to do this? [faster, more scalable] Such a fopen(), etc...
View Replies !
String - Flat-File CMS
I am still working on my flat-File CMS, so far it looks pretty good, but I have recently made a news section with a Pagination, and I can not figure out why this string right here will not work. PHP Code: $nstring = " <?phpn$i++;n$link[$i] = "<h1>".$title."</h1><div class='htimeauth'> |".$date."| <a href='#'>".$author."</a></div> <p>".$story."</p>"; if (!preg_match($d, $link[$i])) $link[$i] = preg_replace ('/one/', 'two', $link[$i]); ?>"; Note: the error I get is. HTML Code: Parse error: syntax error, unexpected '"' in /publish.php on line 28
View Replies !
Get Data From A Flat File Like A Db
I have about 400 widgets with a price and I have it in an XML file now. I figured out how to get it from the XML file I just have to read the xml until I find what I want every time the page opens. Is there an easier way to get data from a flat file without reading going through it link by line. I don't have to keep it xml I can convert it to something else. Is there a way to index and XML file or any txt file and just say go to line 40 and get data. The order of the widgets is not important and the only thing that will change is the price. Also is just reading the file with 400 items in it not that much of a drain and I should not worry about it. I only need a db for this one thing. I don't want to have to pay extra for this.
View Replies !
Flat File Pagination
I'm using a flat file to keep the data for my downloadable files. I'm using the explode function to take info and make it an array. It works extremely well for my purposes. Now I have gotten to the point where there are too many downloads. Is there any easy way of making a pagination, displaying 10 items per page from the flat file (.txt)?
View Replies !
Total Row Of A Flat File
This one is easy, i want to count the total row of a flat file. Let say i have a file called 'myfile.txt'now inside that text file it has text content rows like below, 1. banana //first row 2. orange 3. papaya 4. grapes 5. lemon //last row now how do i count the total row of this text file and display the result? I think i done this before i just lost the script tho.
View Replies !
Flat File Problems
im trying to make a light simple guestbook for a guy who is hosting on my server and i didnt want to clutter my sql db so i am useing flat file so i make a test page to see if it works and the results were good but when i make the real page it doesnt work i went over it 2 or 3 times and i cant spot anything and im not getting any errors Code:
View Replies !
Conversion Of Flat File To Sql
i currently have a member script that uses a flat file database. i want to switch member sciprts that used mysql. is there anyway i can automatically transfer my user 's data from my flat file to sql?
View Replies !
Flat File Usage
what i want to do, is when i upload a image through a script, it writes a line in a txt file, that includes the url to the image uploaded, then another script that will take that txt, and import that url into a page. When another image is uploaded, it will delete that txt line, and replace it with the new url of the uploaded image.
View Replies !
Flat File Databases
I've recently been trying to build a user specific phone book using flat file databases. Basically I want php to create a flat file that is unique, and only accessible by that particular user. So when the file is created for example, each database reflects the particular users name, danny.txt for instance. So danny logs onto the site, and browses to the phonebook page, where php loads only his particular flat file database and lets him edit it accordingly. Any help would be much appreciated, I've looked through various tutorials but none seem to indicate how to create user specific databases.
View Replies !
Using Flat File Databases
Is it okay to not use MySql and just use flat file databases to power a user management thing? I don't have any problems using flat file databases and I was just wondering if there are any major disadvantages.
View Replies !
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
View Replies !
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 :)
View Replies !
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.
View Replies !
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);
View Replies !
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:
View Replies !
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?
View Replies !
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:
View Replies !
|