RE : include file vs db queries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zorro

    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. ;)

    ........
    <?php
    $_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:

    <?php
    echo implode(' &gt; ', $_SESSION['path']);
    ?>
    ..........






    "zorro" <myahact@yahoo. ca> wrote in message
    news:1baa8f0d.0 501031833.45073 247@posting.goo gle.com...[color=blue]
    > Hello,
    >
    > 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
    >
    > include("path_c ategory_".$_GET['cat_id'].".inc");
    >
    > and the file contains:
    > echo "Products > Electronics > Computers > Laptops > Accessories >
    > Mouse";
    >
    > 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?[/color]
Working...