Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]mysqli w klasie
peter13135
post
Post #1





Grupa: Zarejestrowani
Postów: 1 447
Pomógł: 191
Dołączył: 26.03.2008

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


  1. <?php
  2. class news extends conf
  3. {
  4. $a=new mysqli($this->host, $this->user, $this->pass, $this->name);
  5. }
  6. ?>


dlaczego taki zapis wywala błąd (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) w klasie conf są zmienne user, pass itd
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Moli
post
Post #2





Grupa: Zarejestrowani
Postów: 662
Pomógł: 45
Dołączył: 26.03.2007
Skąd: Warszawa

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


Zobacz jak buduje się klasy. Chodziło Ci chyba o coś takiego
  1. <?php
  2. class news extends conf
  3. {
  4. private $mysqli;
  5.  
  6. public function __construct()
  7. {
  8. $this->mysqli=new mysqli($this->host, $this->user, $this->pass, $this->name);
  9. }
  10.  
  11. }
  12. ?>


ps. dziedziczenie po klasie konfiguracyjnej to głupota (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował Moli 19.03.2009, 21:35:39
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: 12.10.2025 - 05:37