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 Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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:
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.
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.
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?
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:
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,
Editing And Deleting Flat Text Files
I am working on a php news script that uses text files for it's DB. I have most of it done except for the ability to edit or delete the articles in the DB. I have only been coding for about a week now so my skills are pretty limited and I have not found any tutorials that cover this issue so if anyone could be kind enough as to show me how this is done I would be most greatful....
Batch File Deleting And Folder Deleting
I have a folder in my web site where I used php to create and copy in files. but now I can't delete them easily. The only way I know how that is possible is through php. I get an error the following ftp error: 550 th: Permission denied I had the chmod() set to 0777 on every file and folder. But I still seem to loss control over the files when I try and do things with them through other means. I think it is because the user I use to access the files via ftp a diffrent user. So I tryed to add a function with chown() for the new files I was posting and uploading. It didn't work on those new files. so it looks like the only thing I can do is use the unlink() function which deletes the files fine. The only problem is now I have something like 100 sub directories all with files in them. I need to figure out a way to batch delete them. I can't find a script that goes through and finds all file contents including all sub directories and unlink those things. I found some that will use a for loop to list out the contents of a folder but it is just files. No sub directories. Any body got any ideas on which functions I should use or know where a script is that I can base mine off of. I am not sure how to approach this since what I tryed with chown and chmod has failed thus far. I currently have no code and am starting from scratch on this batch flushing of my directory.
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.
Deleting A Row From A Database
I can't fiqure out why my delete function isn't working. I have a listing of rows in my database with an option to delete an individual row at the end: Code:
Deleting From Sql Database
I have used this script I made to delete files from a server and simultaneously remove information about the file from a database. I have uploaded the same script to a new website and it no longer works. The file does get deleted but the database line doesn't get removed. I can tell where it's going wrong by the error custom error message 'echo'ed on the page ("your file was only partially uploaded"), but I really don't know why.
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?
PHPMyAdmin ... Deleting A Database?
I just want to delete a test database that I made, thats it. There is no upfront obvious way of doing this from my pov so thats why I'm asking.
Deleting Records From Database
I have another question about record deletion from database. For example, my database has 10 records with ids 1 through 10. If I delete id #10 then everything is good and all the records are still 1 through 9. However, if I delete record id #4, then in my db I would have records 1 through 10 with id #4 missing. Is there a command that syncs the database? How do I go about this to keep all the ids in the right order after the deletion? or What do I need to do to prevent that from happenning?
Deleting Comments From Database
i have a message board that enters information to the data base fine, but where i try to create a detele for individual comments, it does not seem to work, any ideas on how to write a delete for this so that it deletes individual messages Code:
Deleting Images Associated In Database
I've got a database structure with rows containing filenames of photos on the server each with its own uploader/user and unique id number. Can someone help me on how to delete an array of photos from the server uploaded by a specified uploader/user?
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:
Deleting A Table From A MySQL Database
I've looked at the manual and a few other php resources, but yet I couldn't find a simple and easy way to delete a table using php. I noticed there is a destroy() function within the MySQL class, but I'm not sure how it's used.
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);
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:
Checking If A Value Is Not In An Array And Deleting Record From Database
I have been trying to figure this one out and have come up against a brick wall although I know it should be relatively simple. I have a form that passes an array to a php script from a multiple select box that is created dynamically. If a user deselects an item then I want to delete the record from the database but am having a big problem with it. The table in the dbase is quite simple with just three fields: id classid formid Basically, the form send through a classid and a formid value and I want to delete any records that have a classid that are not in the form array and have a formid which is passed as a hidden value. I suppose really what I want is to know how to see if a classid is not in the array that is passed.
Deleting Database Rows From An Array Of Variables
I have a form with a list of checkboxes, which are each filled with a date in the format 27012007, for example. The name of each of the checkboxes is the same as the date. Basically when the user presses the submit button I would like all rows in the database table "users" with the corresponding column "date" to be deleted when the form variables date correspond to those in the "date" rows. I think all the checked dates might also need to be put into an array. Would anyone know how to do this?
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:
|