PHP OO newbie question

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

Threaded View

I've been programming in PHP for a while and am just trying to tackle
some Object Oriented code for the first time.

I'm starting out by writing a simple phonebook, to display people's
name & phone number from a mysql database.

I've read quite a few tutorials and think I understand classes &
methods, but am just having trouble getting my head around how to set
it all out in code.

Can one of you OO gurus cast your eye over this early code and give me
some feedback?  I get the part of setting up a person object and
working from there, but it's the listing part (listing all people in
the phonebook) that I'm struggling with.

Thanks heaps in advance.

class person {
     var $firstname;
     var $surname;
     var $phonenumber;

class personListing {
     var $listing = array();

    function personListing($personarray) {
        $sql = "select * from TPEOPLE";
        $result = mysql_query($sql);
        $this->listing = mysql_fetch_array($result);

Re: PHP OO newbie question wrote:
Quoted text here. Click to load it
I would recommend using the PHP 5 OOP system as it got totally redone
it PHP 5. You can have private functions and vars. The tutorial for the
current OOP system I found to be very helpful. That's where I would
Quoted text here. Click to load it

Site Timeline