470,815 Members | 1,265 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

RE : include file vs db queries

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*****@yahoo.ca> wrote in message
news:1b**************************@posting.google.c 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: "path_category_32.inc".
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
0 1341

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jez | last post: by
6 posts views Thread by zorro | last post: by
3 posts views Thread by middletree | last post: by
2 posts views Thread by David Arden Stevensonn | last post: by
4 posts views Thread by Jon | last post: by
9 posts views Thread by Bob Bedford | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.