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

Posted by Benjamin on 11/22/06 03:41

david_longrunner@yahoo.com wrote:
> 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.
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
start. http://us3.php.net/manual/en/language.oop5.php
>
> 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

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