próbuję zrozumieć co jest źle w poniższym kodzie, że pojawiaja się ostrzeżenia. Co robię źle?
class __construct{ private $host = "localhost"; private $username = "root"; private $password = "pass"; private $database = "database"; public function SQLConnection($host, $username, $password, $database){ try{ $db = new PDO('mysql:host='.$host.';dbname='.$database.'', ''.$username.'', ''.$password.'',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); }catch(PDOException $e){ } }
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
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