Re: OOP in PHP

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

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux