- - PDO Class problem
||05-22-2011 01:52 PM
PDO Class problem
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:
$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:
//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();
$content_var .= $MESSAGE_SUCCESS['register'];
This is my class (part of):
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);
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?
||05-26-2011 05:23 PM
Check to see if
. If it is
then there was an error and you should use PDOStatement->errorInfo()
to get the error message.
|All times are GMT. The time now is 11:45 AM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0