Re: OOP in PHP

From: Date: Wed, 15 Aug 2007 21:17:02 +0000
Subject: Re: OOP in PHP
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-260881@lists.php.net to get a copy of this message
Jim Lucas wrote:
Patrik Hasibuan wrote:
Dear Jim, thanks for your help. I've modified my codes as you adviced. But than the output is: " superclass koneksi dipanggil koneksi berhasil No results found " The column 'country' of table 'countries' already really contents complete all contry name from all over the earth. How come the query of "select country from countries" results empty value. So I believe the problem is still on the my OOP programming because if I do the query only with the "procedural concept" the $kueri will content the complete record of the column "country". Please keep telling what is my mistake on my OOP PHP5 codes. ----- //pelangganbaru.php
    <?php
    include_once "koneksi.php";
    $sqlnya="select * from countries";
ok, don't know why it took me this long to realize what the problem is. The following line will return the object of a the class that you are initializing, not the result set pointer. So, what you need to do is this Change this function koneksi($sqlnya){ ... } to this function getkoneksi($sqlnya) {
oops this should be get_koneksi($sqlnya)
... } Then this $klas=new koneksi($sqlnya); to this $o = new koneksi(); $klas = $o->get_koneksi($sqlnya); Now all should work.
-- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#260881) next »