Jump to content

Which approach is more effiecient - file or db entry?


Recommended Posts

Hi, I am in the early stages of developing a web app in PHP/MySQL. It is predominantly procedural (with type of MVC approach)in coding style though I do have some classes included().


ATM, I have my navigation links going straight to a bare-bones file that sets up variables for that page, such as: $pageAuthLevel, $metaPageTitle, $metaPageContent, $metaPageKeywords. Also defined in this page is the include paths for the actual html content file, the pages controller and lastly the pages view.


I know I could include all this data in a MySQL db table and the include files from within the controller.


The advantage of doing it the way I have it currently, is that the links are already written in an SEO friendly manner eg: /about-this-site.php and saves me from having to learn and setup mod_rewite in an .htaccess file. The disadvantage is that I have an additional file for every 'content' file, but the filesize is small and disk space is cheap.


My question is though, which method is more efficient in terms of performance,  scalability and security?

Link to post
Share on other sites

I would learn mod_rewrite.


This has to do with maintainability.  Having to to touch 100, 1000, or w/e php files to update something, even using a function to do it is a pain and error prone.  It is a bad habit to rely on something "cheaper" that works when you could do it "right"[in this case a more easily managed method], the first time.


It's up to you, but I've seen a fair amount of mod_rewrite tuts out there that I'm sure you could learn if it would help you out enough.

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.