johng Posted April 19, 2007 Share Posted April 19, 2007 I am creating a site where someone would enter data into a few text boxes, with the potential for them to be fairly long. I am therefore saving them into a text file instead of a database. With these, there is a potential for someone to use the enter key in these boxes, therefore making it very difficult to just parse it out by line. I am currently trying to figure out how to parse it by special characters (or groups of characters such as "%%$$%%" or something that noone would ever type, on purpose or by accident) I was wondering if there was a way to parse this out by these special characters, or if there was a way to save those line returns that the people enter as something other than a line return. Any ideas? (or questions?) Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/ Share on other sites More sharing options...
per1os Posted April 19, 2007 Share Posted April 19, 2007 I would use a database instead of a text file. A ton easier to work with. You do not have to use Varchar(250) which limits it to 250 characters you can use a TEXT field which can take a ton of data. That way there is no messy parsing. My 2 cents. Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233483 Share on other sites More sharing options...
johng Posted April 19, 2007 Author Share Posted April 19, 2007 Will it slow down the database if there is a lot of data there? The amount of data for these fields is going to be paragraphs, not just a sentance or two. I didn't know if there would be the potential for too much data for a text field in a db. Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233486 Share on other sites More sharing options...
effigy Posted April 19, 2007 Share Posted April 19, 2007 I'm a little confused at what you're after, but have you considered regular expressions? Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233488 Share on other sites More sharing options...
johng Posted April 19, 2007 Author Share Posted April 19, 2007 What do you mean by regular expressions? I'll try to clarify what I'm after: I'm creating a page where people will enter quite a bit of data. It has some questions that will have a fairly large place to enter text, with the potential for paragraphs of description. I'm hesitant to put this into a database, because I'm afraid it will slow the database way down. So I decided to put these fields into a text file. But when they enter the data, they have the option to use the "enter" key, which prevents me from being able to just look up the different fields by line. I'm trying to use some special characters, but I'm not sure how to parse out the file using those characters as a stop for the length of the field, like you would do with a new line. Hopefully that is a little more clear, if not, I'll try again. Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233493 Share on other sites More sharing options...
per1os Posted April 19, 2007 Share Posted April 19, 2007 A flat file will be 1,000 times slower than a database. I have a DB that is 150mb's and runs just as fast as it did with 1 MB. Trust me, databases are the way to go. Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233494 Share on other sites More sharing options...
johng Posted April 19, 2007 Author Share Posted April 19, 2007 Is that true even if it was in different files, not just one? Like if each field or each entry was in a different file, and I just had them open to put the text back into the fields for editing? Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233497 Share on other sites More sharing options...
effigy Posted April 19, 2007 Share Posted April 19, 2007 Go with a database and store the information you need in separate fields of a table. If you're trying to search for words, you can use a FULLTEXT index. Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233509 Share on other sites More sharing options...
johng Posted April 19, 2007 Author Share Posted April 19, 2007 Ok, thanks for the help! Link to comment https://forums.phpfreaks.com/topic/47793-solved-parsing-out-a-file-using-special-characters/#findComment-233514 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.