homepage Welcome to WebmasterWorld Guest from 54.166.228.100
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP and flat files vs. MySQL
where is the limit and when to switch
smallcompany




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

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

 

jezzer300




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

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.

MatthewHSE




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved