Design Assistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm hoping someone can help me with some design thinking..   I'm still
fairly new to php and most of my scripts are written in a rather procedural
format.  I'd like to try start thinking in a more object-oriented way.  The
piece I'm working on is rather simple but I'm not sure how to arrange
things.  Basically, I'm making a list of users for a message board and when
the list is displayed, it looks similar to the following:

 

Add User <http://>  

 

|      ID     |       Name     |      Homepage     |   Action        |

----------------------------------------------------------------------------
---------

        1          User1               http://...           Edit <http://>
| Delete <http://> 

        2          User2               http://...           Edit <http://>
| Delete <http://> 

        3          User3               http://...           Edit <http://>
| Delete <http://> 

 

.

I'd like to be able to do things like:

 

$obj = new member;

$obj->firstname = "Tim";

$obj->homepage = "www.myhomepage.com"; 

$obj->saveuser();

 

Or  

 

$obj->deleteuser($id);

 

Or 

 

$obj->getuser($id);

 

I'm not sure if I should include database functionality to this object or if
I should separate it to a database class.

Are there any good examples of doing things like this? I've got the O'reilly
book called PHP Cookbook and I was playing with the example on page 159,
example 7.8..because they start out with what looks like the PEAR DB and
that's what I'm using.

Any thoughts and/or help with this would be greatly appreciated

 

TIA!

 

Jim

 

 

 

 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux