I have a DB that (for the purpose of this email) contains three
tables: projects, comments, and history.  Each project will have its set
of comments added, and as the project advances over time, also its set
of history items.

    This information gets displayed on a web page roughly in the
following form:

    project [#] history [#] comments - where the [#] will be optional,
depending on whether that particular project has any of history or
comments.  The # represents the number of items for that group.  For
example...

    project_x : 3 history : 18 comments

    ...means that project has been changed 3 times, and has 18 comments
attached to it.

    The project table has two fields that are INT(3), and contain the
amount the history or comment items for that project.  So, when you look
at the table, the values will look something like this:

    project_name, 3, 18

    Right now when I display the projects page, it's a single query to
the projects table and it gets all the data it needs.  If someone needs
to read the history, or comments, then it goes out and queries the
respective tables.

    The problem I'm running up against is, say someone's browser gets
stuck, or they're impatient, or for whatever other reason the number of
comments or history gets out of sync with the value in the projects
table, there is no easy way to check for that.  If I list 15 to 30
projects per page, that's 31 to 61 queries for one page: once to the
projects table to get the projects, then for each project I make two
queries, one to the history table and one to the comments table to get
the accurate values (or to verify them).  This seems rather inefficient
to me.

    Has anyone ever run up against something like this, and what
solution(s) (if any) did you come up with?

    AMK4

--
H | Hi, I'm currently out of my mind.  Please leave a message.  BEEEEP!
  |____________________________________________________________________
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
  http://www.pcraft.com                  .        3550 Arapahoe Ave, #6
  .................. .  .  .     .            Boulder, CO 80303, U.S.A.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to