I have database class and constructor function this:
<?php
class Connection {
private $PDO;
function __construct() {
$username = 'root';
$password = 'password';
$PDO = new PDO('mysql:dbname=PROOV;host=localhost', $username, $password);
return $this->PDO;
}
}
?>
And the other class that extends it:
<?php
//$query = 'SELECT part_description FROM SparePartRequests LIMIT 100';
include_once 'connection.php';
class Proov extends PDO {
public function returnRows() {
$sth = $this->prepare('SELECT part_description FROM SparePartRequests LIMIT 100');
$sth->execute();
$result = $sth->fetch();
return $result;
}
}
$proov = new Proov(); // <- this is line nr 19...
?>
And it throws exception: Warning: PDO::__construct() expects at least 1 parameter, 0 given in /var/www/proov/proov1.php on line 19
How can i fix my problem? Thanks for any help!
Thanks for any help!