By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

RE : include file vs db queries

P: n/a
Thanks all for your suggestions. I'm definitely scrapping my method
for now.

I liked the following idea most but I'll probably go with the db
method because it's probably easiest to manage. ;)

$_SESSION['path'] = array('Products', 'Electronics', 'Computers',
'Laptops', 'Accessories', 'Mouse');

Of course it would have to be changed everytime the user moves around
your site. Then just output it at the checkout page:

echo implode(' &gt; ', $_SESSION['path']);

"zorro" <my*****> wrote in message
news:1b************************** om...

I'm programming an Amazon type web site and find myself "wasting" a
lot of time writing code that gets information from include files
rather than from the database because I have this notion that it will
avoid clogging the db when many users come to the site. My main goal
anyway is to have the user wait as little as possible because that's
good for business apparently.

Here's an example:

When the user will be checking out a certain product I'll have to
display at the top of the page the product category path. For instance

Products > Electronics > Computers > Laptops > Accessories > Mouse

If I wanted to code quickly I could write a function that builds this
path by querying the database and run the function every time someone
accesses a page. Instead I have a folder "Paths" containing an include
file for every category possible. For example: "".
In my web page I do something like


and the file contains:
echo "Products > Electronics > Computers > Laptops > Accessories >

I have code that generates these include files and I only have to run
it when a category is added, removed or renamed - which will be rare.
Is this not a lot better than querying the database 1000 times a day
just to get information that is static? Now this was one example but
there are many other elements I could apply this method to. The
problem is that it takes a lot longer time to code and I also have a
delivery date to meet, yet I don't want to deliver something that is
not efficient because it queries the db all the time.

Any advice?

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.