![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 250 Pomógł: 1 Dołączył: 6.08.2012 Ostrzeżenie: (0%) ![]() ![]() |
Cześć,
próbuję zrozumieć co jest źle w poniższym kodzie, że pojawiaja się ostrzeżenia. Co robię źle?
Kod Warning: Missing argument 1 for __construct::SQLConnection(), called in C:\WebServ\httpd\oop_mvc\index.php on line 12 and defined in C:\WebServ\httpd\oop_mvc\controller\ConfigDatabase.class.php on line 18
Warning: Missing argument 2 for __construct::SQLConnection(), called in C:\WebServ\httpd\oop_mvc\index.php on line 12 and defined in C:\WebServ\httpd\oop_mvc\controller\ConfigDatabase.class.php on line 18 Warning: Missing argument 3 for __construct::SQLConnection(), called in C:\WebServ\httpd\oop_mvc\index.php on line 12 and defined in C:\WebServ\httpd\oop_mvc\controller\ConfigDatabase.class.php on line 18 Warning: Missing argument 4 for __construct::SQLConnection(), called in C:\WebServ\httpd\oop_mvc\index.php on line 12 and defined in C:\WebServ\httpd\oop_mvc\controller\ConfigDatabase.class.php on line 18 PoĹÄ czenie nawiÄ zane! Fatal error: Call to a member function query() on a non-object in C:\WebServ\httpd\oop_mvc\controller\ConfigDatabase.class.php on line 28 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 3 034 Pomógł: 366 Dołączył: 24.05.2012 Ostrzeżenie: (0%) ![]() ![]() |
Jest ok ale sa dwa ale pierwsze teraz parametry w deklkaracji i wywolaniu metody sa nie potrzebne. Drugie taka klasa nic Ci nie daje bo itak musisz do niej zajrzec zeby cos zmienic w polaczeniu. Najlepsze to obecnie jest stosowanie DI czyli przekazujesz sam obiekt do konstruktora (IMG:style_emoticons/default/smile.gif)
No to kolega Boshi dal Ci przyklad jak to w zasadzie powinno wygladac dla twojego przypadku kiedy chcesz robic to w taki sposob (IMG:style_emoticons/default/smile.gif) @down maly blad sie wkradl $this->pole zamiast $this->field :-D Ten post edytował com 10.03.2015, 02:02:54 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 7.10.2025 - 03:28 |