View Single Post
Old 05-22-2011, 01:52 PM   #1 (permalink)
newwarrior
The Visitor
Newcomer 
 
Join Date: May 2011
Location: Germany
Posts: 1
Thanks: 0
newwarrior is on a distinguished road
Default 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->USERNAMEPDO::PARAM_STR);
$sth->bindParam(2$this->PASSWORDPDO::PARAM_STR);
$sth->bindParam(3$this->EMAILPDO::PARAM_STR);
$sth->bindParam(4$this->ZEROPDO::PARAM_INT);
$sth->bindParam(5$this->ACTIVATE_KEYPDO::PARAM_STR);
$sth->bindParam(6$this->REGISTER_DATEPDO::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?
Send a message via ICQ to newwarrior Send a message via Skype™ to newwarrior
newwarrior is offline  
Reply With Quote