Welcome to WebmasterWorld Guest from 107.22.14.254

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP and flat files vs. MySQL

where is the limit and when to switch

     
4:39 am on Mar 9, 2009 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I have a simple code that calls a flat file, checks lines, and if it does not find an entry, it appends it. I use it to write down the keywords. Every time a visitor comes, the file is opened, checked, written in if there was no keyword, and closed.

So far, depending on the site, the flat file has gone up to close to 1 MB. I'm just thinking that opening a file and checking so many lines from top to bottom is not so smart.

I'm kind of set to switch to MySQL, but I'm still curious about your experience with flat files vs. MySQL (in PHP environment).
I know that the server performance is No.1, but still there must be more to it that drives web developers in making their decisions between flat file and database.

With the move to MySQL, I hope to get faster read/write, and to be able to count number of searches for keywords that are already in the database.

Any right/wrongs?

Thanks

2:03 pm on Mar 9, 2009 (gmt 0)

10+ Year Member



Not only are flat files slow for large amounts of data they don't allow you to analyse the data and sort it so easily.

Mysql would be easy to use in this case.

2:10 pm on Mar 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As you say, MySQL would allow you to keep track of how many times each keyword was used, which seems like it would be useful data to me.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month