flexybash Posted December 28, 2010 Share Posted December 28, 2010 hello guys i heard there is a way that you can make something like a database on a text editor and when ever u want to change the info you just open a text editor and change the information How is this called? where can i find a tutorial? any tips? thanks you very much Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/ Share on other sites More sharing options...
Zurev Posted December 28, 2010 Share Posted December 28, 2010 Check out phpmyadmin, I believe that's what they were referring to. There are others out there, this generally comes with most hosting services, and is installed by default with WAMP or XAMP. It's not from a text file, but it provides a user interface for changing your database information/structure. Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152147 Share on other sites More sharing options...
BlueSkyIS Posted December 28, 2010 Share Posted December 28, 2010 ... and is installed by default with WAMP or XAMP. and MAMP for Mac users. Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152157 Share on other sites More sharing options...
the182guy Posted December 28, 2010 Share Posted December 28, 2010 Sounds like you want to create a flat file 'database'. Like a CSV? Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152172 Share on other sites More sharing options...
Maq Posted December 28, 2010 Share Posted December 28, 2010 hello guys i heard there is a way that you can make something like a database on a text editor and when ever u want to change the info you just open a text editor and change the information How is this called? where can i find a tutorial? any tips? thanks you very much Why do you want to do this? Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152188 Share on other sites More sharing options...
flexybash Posted December 28, 2010 Author Share Posted December 28, 2010 Hello, Thanks for all the responses, i do have mamp, i do know what phpmyadmin is etc, But i have seen there is a way you make a textfile a database and you can just change the content from the .txt i want to do this because its a easier way to manage a website, just open up the .txt and change the content instead of having to go to phpmyadmin etc Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152207 Share on other sites More sharing options...
Maq Posted December 28, 2010 Share Posted December 28, 2010 i want to do this because its a easier way to manage a website, just open up the .txt and change the content instead of having to go to phpmyadmin etc Trust me, creating a relational database is well worth it and a lot easier. Their purpose is to store data. Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152210 Share on other sites More sharing options...
the182guy Posted December 28, 2010 Share Posted December 28, 2010 Using a flat file instead of a RDMS because it's "easier" to modify the data is an invalid reason to use a flat file. Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152217 Share on other sites More sharing options...
fortnox007 Posted December 28, 2010 Share Posted December 28, 2010 i wouldn't recommend it, but you might want to look in this: http://www.tizag.com/phpT/filewrite.php Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152226 Share on other sites More sharing options...
Zurev Posted December 28, 2010 Share Posted December 28, 2010 Hello, Thanks for all the responses, i do have mamp, i do know what phpmyadmin is etc, But i have seen there is a way you make a textfile a database and you can just change the content from the .txt i want to do this because its a easier way to manage a website, just open up the .txt and change the content instead of having to go to phpmyadmin etc So I assume you're talking about flat-filing your website instead of using a database completely? Trust me even if databases seem intimidating, databases in the long haul will be so much better for most cases. Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152236 Share on other sites More sharing options...
litebearer Posted December 28, 2010 Share Posted December 28, 2010 I totally agree with the consensus that a real db is the way to go; that said here is a simplistic example of 'flat file db'. Step 1. determine what information you will be storing - for this example a very simple address book. These are like fields in a real database first name last name street address city state zip telephone cellphone email address comments Step 2. determine what character you can safely use to separate (delimit) the 'fields' - because names, addresses, comments might contain apostrophes or commas or spaces, a safe bet is the pipe |. first name|last name|street address|city|state|zip|telephone|cellphone|email address|comments Step 3. each line represents a 'record', all records are in the same order and are tenimated with the newline character \n. if you accidentally add a newline/carriage return to a "field's" content you WILL have problems. Step 4. Adding to the file can be accomplished via a text editor. Step 5. Accessing the file and records via php. $lines = file($name_of_the_text_file); this will put all of the lines from the text file into an array. to access the individual 'fields' of the line, you need to convert the line into a new array. $line_array = explode("|", $lines[0]; to display the telephone number you would... echo $line_array[6]; If there will be VERY limited amounts of information, yes a flatfile can be 'easy' to use. The downfalls come when searching, deleting, updating, sorting and many other tasks. Also, making a page/form/function that allows you to add/edit/delete/etc information in/from a real db is not difficult and does NOT require you to 'access' phpadmin. Make sense? Quote Link to comment https://forums.phpfreaks.com/topic/222824-fetching-info-from-txt/#findComment-1152272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.