| newwarrior |
05-22-2011 01:52 PM |
PDO Class problem
Hello,
I have a little problem with a class that I used for my website, where the user could register.
This is the part for DB Connection:
PHP Code:
$dbh = new PDO("mysql:host=$DB_DATA_HOST;dbname=$DB_DATA_DATABASE", $DB_DATA_USER, $DB_DATA_PASSWORD);
This is the call for my class:
PHP Code:
//CREATE NEW CREATE OBJ
$create_user = new user($dbh);
$create_user->USERNAME = $_POST['username'];
$create_user->PASSWORD = md5($_POST['password']);
$create_user->EMAIL = $_POST['email'];
$create_user->REGISTER_DATE = time();
if($create_user->createUser())
$content_var .= $MESSAGE_SUCCESS['register'];
This is my class (part of):
PHP Code:
public function __construct($dbh)
{
$this->dbh = $dbh;
}
public function createUser()
{
$ZERO = 0;
$this->OPERATION = true;
$this->ACTIVATE_KEY = $this->createRandomKey(25);
$sth = $this->dbh->prepare('INSERT INTO user(username, password, email, active, activate_key, register_date) VALUES(?,?,?,?,?,?)');
$sth->bindParam(1, $this->USERNAME, PDO::PARAM_STR);
$sth->bindParam(2, $this->PASSWORD, PDO::PARAM_STR);
$sth->bindParam(3, $this->EMAIL, PDO::PARAM_STR);
$sth->bindParam(4, $this->ZERO, PDO::PARAM_INT);
$sth->bindParam(5, $this->ACTIVATE_KEY, PDO::PARAM_STR);
$sth->bindParam(6, $this->REGISTER_DATE, PDO::PARAM_INT);
$sth->execute();
The problem is, that there is no DB entry.
I get no error message or notice message.
I don't find the problem.
Could you maybe help me?
|