Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] nie dzialaja metody rodzica w klasie dziedzinej
become
post
Post #1





Grupa: Zarejestrowani
Postów: 88
Pomógł: 0
Dołączył: 12.01.2007

Ostrzeżenie: (0%)
-----


  1. <?php
  2. Class myDB extends DB {
  3.  
  4.  function selectUsers($element) {
  5. $q="
  6. SELECT *
  7. FROM users
  8. WHERE id=$element
  9. ";
  10. $res=$this->getRow($q, array(), DB_FETCHMODE_ASSOC);
  11. if (PEAR::isError($res)) {
  12.  die($res->getMessage() . ' | ' . $res->getDebugInfo());
  13. }
  14.  }
  15.  
  16. }
  17. ?>


wywala błąd
Call to undefined method myDB::getRow()

getRow jest metodą clasy DB pakietu PEAR

próbowałem przez parent::getRow ale jest dokładnie to samo.

Ten post edytował become 23.01.2007, 11:39:31
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
become
post
Post #2





Grupa: Zarejestrowani
Postów: 88
Pomógł: 0
Dołączył: 12.01.2007

Ostrzeżenie: (0%)
-----


no widzę teraz.
ze DB_common jest klasą interfejsu.

czy to oznacza, że muszę stworzyć osobną klase dziedziną dla tego interfejsu ?

bo w takim razie jakim cude działa to:
  1. <?php
  2. // Create a valid DB object named $db
  3. // at the beginning of your program...
  4. require_once 'DB.php';
  5.  
  6. $db =& DB::connect('pgsql://usr:pw@localhost/dbnam');
  7. if (PEAR::isError($db)) {
  8. die($db->getMessage());
  9. }
  10.  
  11. // Proceed with a query...
  12. $res =& $db->query('SELECT * FROM clients');
  13.  
  14. // Always check that result is not an error
  15. if (PEAR::isError($res)) {
  16. die($res->getMessage());
  17. }
  18. ?>


skoro metoda query tez nie istnieje w clasie DB

co wogole oznacza znak "&" przed wywolaniem metod ?

Ten post edytował become 23.01.2007, 11:49:23
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.12.2025 - 18:33