private $dbhost = "localhost";
private $dbname = "bootfor";
private $dbuser = "root";
private $dbpass = "";
private $dbh;
public $row;
function __costruct()
{
try {
$this->dbh = new PDO("mysql:host=$this->dbhost;charset=utf8;dbname=$this->dbname", $this->dbuser, $this->dbpass);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $error) {
print "<br > Error!: " . $error->getMessage() . "<br />";
}
}
public
function categories()
{
$this->dbh->prepare("select categories");
$this->dbh->execute();
$this->row = $this->dbh->fetch();
}
Error:
Fatal error: Call to a member function prepare() on a non-object in F:\index.php on line 35
I am probably being stupid but, any ideas as to why this is a non-object? I've tried looking at it a few hundred times but I can't figure it out, I've fixed this issue before I just can't remember how...