I am very beginner in PHP.
When I am registering a new user, I received an unproper 'return' (-1 instead of 1) when I am using mysql_query. Without line with "mysql_query" return is proper.
What am I doing wrong?
public function register ($username, $password, $activationcode) {
$username = $this->parse($username);
$password = $this->parse($password);
$query_search = "SELECT * from tbl_user WHERE username = '".$username."' ";
$query_exec = mysql_query($query_search) or die(mysql_error());
$no_of_rows = mysql_num_rows($query_exec);
if ($no_of_rows == 0)
{
$newUser="INSERT INTO tbl_user(username, password,activationcode) VALUES ('".$username."', '".$password. "','".$activationcode."')";
if(mysql_query($newUser))
{
return 1;
}
}else {
return -1;
}
}