![]() |
![]() |
![]()
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: 342 Pomógł: 15 Dołączył: 30.08.2011 Ostrzeżenie: (0%) ![]() ![]() |
Jeżeli już to konstruktor powinien łączyć się z bazą przy tworzeniu instancji klasy. Nie robi się etykiet publicznych-łamiesz jedną z podstawowych zasad OOP- hermetyzacje. Nie wiem po co też tworzysz funkcje przyjmująca parametry a przy tym deklarujesz pola publiczne z danymi.
Tak jak kolega com. napisał, do zmiennych wewnątrz klasy odwołujemy się po przez $this->zmienna. A po to jest to zrobione by wiedzieć która zmienna jest lokalną a która polem klasy. ufff
Edit: @up poprawione (IMG:style_emoticons/default/smile.gif) Ten post edytował Boshi 10.03.2015, 02:46:00 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 7.10.2025 - 17:53 |