469,584 Members | 2,333 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

selecting/using multi-table data how do you manage 'current record'?

I am working on a DB for family data, and in this application the data
spans variable amount of rows in multiple tables (one for the adults
data, one for "family", one for the kids, another for employment
schedule, and another for businesses, etc.). I was thinking on
selecting the entire family (IDs of all the related records) and
storing them in a session array for easy access (from script to
script) as I edit the data, but am wondering if there is a better way;
what other methods do any of you guys have have?

Am I correct in thinking this could be contained in a class? (I kinda
get classes but not all the way yet) And if a class is a good thing
- how is it persistent from script to script?

Aug 14 '07 #1
2 1818
la***@portcommodore.com wrote:
I am working on a DB for family data, and in this application the data
spans variable amount of rows in multiple tables (one for the adults
data, one for "family", one for the kids, another for employment
schedule, and another for businesses, etc.). I was thinking on
selecting the entire family (IDs of all the related records) and
storing them in a session array for easy access (from script to
script) as I edit the data, but am wondering if there is a better way;
what other methods do any of you guys have have?

Am I correct in thinking this could be contained in a class? (I kinda
get classes but not all the way yet) And if a class is a good thing
- how is it persistent from script to script?
Hi,

Putting the data in $_SESSION could make sense, and it could very well not.
It depends on how big the structure (resultset) is you retrieve from the
database.
Sessiondata is saved to disk from page to page to make it persistent.
So if you session is 2 megabyte big, this will slow down your app a lot,
because of the saving and loading of such a big file.
(But also doing such a query every time on each page will probably make
your application slow.)

The bottomline is that it is hard to predict.

Personally I like to keep my sessions small, and make my queries smart.

About putting things in a class: That will not help you. Using objects
is a way of programming, not a way of optimizing your application
(speedwise, but it can increase the readability/structure of your code
of course).

My advise: Put things in a query that are really handy to have around
(such as userid, name, rights, etc) and leave the big amounts of data in
the database. A well structured database is VERY fast.

If you are unsure you can always profile the 2 approaches.
Simply store the microtime at the beginning of the script, and get it at
the end, and spit out the difference. Try this for Session-approach and
db-queries.

Remember that is the server is under heavy load, things might change a lot.

Hope that helps.

Regards,
Erwin Moller
Aug 14 '07 #2
la***@portcommodore.com wrote:
I am working on a DB for family data, and in this application the data
spans variable amount of rows in multiple tables (one for the adults
data, one for "family", one for the kids, another for employment
schedule, and another for businesses, etc.). I was thinking on
selecting the entire family (IDs of all the related records) and
storing them in a session array for easy access (from script to
script) as I edit the data, but am wondering if there is a better way;
what other methods do any of you guys have have?

Am I correct in thinking this could be contained in a class? (I kinda
get classes but not all the way yet) And if a class is a good thing
- how is it persistent from script to script?
I agree with Erwin. If your database is properly designed, access to
your data will be fast. Much better than keeping it in the session.

Objects (instantiations of classes) are just like other variables - no
more and no less persistent.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Phil Powell | last post: by
3 posts views Thread by debugger | last post: by
1 post views Thread by Alvey Sidecast | last post: by
1 post views Thread by Bob Loveshade | last post: by
3 posts views Thread by mark | last post: by
3 posts views Thread by Novice Computer User | last post: by
2 posts views Thread by tamashee | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.