Well I'm working on insert a user into a database, I could swear I've been here before...
error
<b>Fatal error</b>: Call to undefined method Database::bindValue()
try
{
$db = new Database;
$success = ["message" => "Please check your Email address to activate your account"];
$db->prepare('INSERT INTO username (username, password, email, profileImg, profileImgPath, profileImgType, accountStatus, verified, joined)
VALUES
(:username, :password,:activationCode, :email, :filename, :filepath, :filetype, 0, NOW())');
$db->bindValue(':username', $username);
$db->bindValue(':email', $email);
$db->bindValue(':password', password_hash($post['password'], PASSWORD_DEFAULT));
$db->bindValue(':activationCode', $activationCode);
$db->bindValue(':filename', $filename);
$db->bindValue(':filepath', $filepath);
$db->bindValue(':filetype', $filetype);
$db->execute();
$code = 'https://gotsocial.co.uk/gotsocial/active.php?activecode=' . $activationCode . '.
';
$to = $post['email'];
$subject = 'GOT Social';
$from = "register@gotsocial.co.uk";
$result = mail($to, $subject, $code, "From: $from");
}
catch(Exception $e)
{
$errors[] = ["name" => "username", "error" => "Username or E-mail may already be registered"];
}
}
<?php
class Database extends PDO
{
private $host = 'localhost';
private $user = 'root';
private $pass = '';
private $dbname = 'shops';
public function __construct($host = null, $user = null, $pass = null, $opts = null)
{
parent::__construct("mysql:host={$this->host};dbname={$this->dbname}", $this->user, $this->pass, $opts);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
}