jimmycdinata
asked on
Is there any best practice for master detail web programming?
Experts,
I want to create some master detail program using php. The question is:
Do I need insert everytime user added a new detail to database or just store the details in sessions the flush to database when user is finish?
I need the drawback and benefit of those choices. Thanks
I want to create some master detail program using php. The question is:
Do I need insert everytime user added a new detail to database or just store the details in sessions the flush to database when user is finish?
I need the drawback and benefit of those choices. Thanks
I have no idea what a "master detail program" is. But sessions are temporary. Anything you want saved in a database should be saved when you get it. If you wait, you will find out that a lot of users don't logout or finish a session properly so the data never gets put in the database.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I think you are in the right way.
There is not sense to save the master in the database, if the user is not "finished".
I have used the session to save objects (classes), with the master, and the collection of details.
And just saving when the user finish
For example with a E-commerce system, you can let the user to explore and add items to the cart,
and you can save those items in the session, and when the user finish the buying, then save all the data in the database
There is not sense to save the master in the database, if the user is not "finished".
I have used the session to save objects (classes), with the master, and the collection of details.
And just saving when the user finish
For example with a E-commerce system, you can let the user to explore and add items to the cart,
and you can save those items in the session, and when the user finish the buying, then save all the data in the database