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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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?

Re: selecting/using multi-table data how do you manage 'current record'? wrote:
Quoted text here. Click to load it


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  
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  

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

Hope that helps.

Erwin Moller

Re: selecting/using multi-table data how do you manage 'current record'? wrote:
Quoted text here. Click to load it

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.

Site Timeline