Reputation: 9855
Im having trouble trying to insert a value into my database, 'randomkey' is inserting as 0...
on one page I have...
if($usersClass->register($_POST['produgg_username'], md5($_POST['produgg_password']), $_POST['produgg_email'], $randomkey))
and the page which does the insert...
public function register($username, $password, $email)
{
$rs = mysql_query("INSERT INTO `$this->usersTable` (`username`, `password`, `email`, `randomkey` )
VALUES
('".mysql_real_escape_string($username)."',
'".mysql_real_escape_string($password)."',
'".mysql_real_escape_string($email)."',
'".$randomkey."'
)");
if($rs) {
return mysql_insert_id();
}else{
return false;
}
}
Upvotes: 0
Views: 101
Reputation: 29141
You forgot to include it in the accepted paramters:
public function register($username, $password, $email)
Should be:
public function register($username, $password, $email, $randomkey)
Upvotes: 3
Reputation: 1430
public function register($username, $password, $email, $randomkey)
{
$rs = mysql_query("INSERT INTO `$this->usersTable` (`username`, `password`, `email`, `randomkey` )
VALUES
('".mysql_real_escape_string($username)."',
'".mysql_real_escape_string($password)."',
'".mysql_real_escape_string($email)."',
'".$randomkey."'
)");
if($rs) {
return mysql_insert_id();
}else{
return false;
}
}
Upvotes: 1