By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,364 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,364 IT Pros & Developers. It's quick & easy.

OOP page: Where to put update, insert, delete

P: n/a
jn
I have a page that shows info from MySQL. It is for an online education
site. It uses different classes arranged in a hierarchy. Each lesson is
roughly laid out like this:

Lesson
|-Intro
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Summary

I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside the
classes? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and only
use the objects to display the data from the database?

I am sure many of you have done this sort of thing before. Any help would be
appreciated!
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
jn wrote:
I have a page that shows info from MySQL. It is for an online education
site. It uses different classes arranged in a hierarchy. Each lesson is
roughly laid out like this:

Lesson
|-Intro
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Summary

I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside the
classes? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and only
use the objects to display the data from the database?

I am sure many of you have done this sort of thing before. Any help would be
appreciated!

Strictly speaking each class should have a method to save itself. The
save method for the lesson would then call save for each section which
would call save on each procedure etc.

Having said that you might not want the save code available for every
user as a security precaution. If there is only one admin web page that
the save goes on then I tend to include the validation and save code on
that so I know it's not available to the main website.

Jul 17 '05 #2

P: n/a
Hi jn!

On Mon, 20 Oct 2003 11:51:01 GMT, "jn" <js******@cfl.rr.com> wrote:

(...)
I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside the
classes? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and only
use the objects to display the data from the database?

I am sure many of you have done this sort of thing before. Any help would be
appreciated!
Yes, it has been done 100 times. I have implemented a class set that
handles this from one file, with a Strategy pattern.

Have a look at the thing in the signature.

HTH, Jochen


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #3

P: n/a
jn

"Jochen Daum" <jo*********@cans.co.nz> wrote in message
news:50********************************@4ax.com...
Hi jn!

On Mon, 20 Oct 2003 11:51:01 GMT, "jn" <js******@cfl.rr.com> wrote:

(...)
I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside theclasses? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and onlyuse the objects to display the data from the database?

I am sure many of you have done this sort of thing before. Any help would beappreciated!


Yes, it has been done 100 times. I have implemented a class set that
handles this from one file, with a Strategy pattern.

Have a look at the thing in the signature.

HTH, Jochen


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/


That thing's pretty cool (and complicated) :)
Jul 17 '05 #4

P: n/a
jn

"Kevin Thorpe" <ke***@pricetrak.com> wrote in message
news:3f*********************@news.easynet.co.uk...
jn wrote:
I have a page that shows info from MySQL. It is for an online education
site. It uses different classes arranged in a hierarchy. Each lesson is
roughly laid out like this:

Lesson
|-Intro
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Section
| |-Procedure
| |-text, video, images
|
|-Summary

I have all the classes working properly for displaying info from the
database. Now I am building the admin site.

Where should I put the update/insert/delete code? Would those go inside the classes? Should I use the lesson object when doing the maintenance? Or,
should I just have a separate page that handles the database stuff and only use the objects to display the data from the database?

I am sure many of you have done this sort of thing before. Any help would be appreciated!

Strictly speaking each class should have a method to save itself. The
save method for the lesson would then call save for each section which
would call save on each procedure etc.

Having said that you might not want the save code available for every
user as a security precaution. If there is only one admin web page that
the save goes on then I tend to include the validation and save code on
that so I know it's not available to the main website.


Thanks. I'm putting the code in there now.
Jul 17 '05 #5

P: n/a
Hi jn!
Have a look at the thing in the signature.

HTH, Jochen
>


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/


That thing's pretty cool (and complicated) :)


Thats right. I haven't been targetting point-and-click users so far,
rather the guy that has build an admin interface for a database 100
times.

Hope it helps still,

Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.