You are here: PHP OO newbie question « PHP Programming Language « IT news, forums, messages
PHP OO newbie question

Posted by david_longrunner on 11/21/06 23:07

Hi,

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


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);
}
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация