[eluser]jedd[/eluser]
As an aside, this looks cumbersome:
[quote author="anna16" date="1290269515"]
Code:
if ($query->num_rows() > 0) //if exist assign message as data
{
return $error_message = "Sorry the email is already in used, please try again.";
}
else //else proceed to check_username()
{
return $error_message = "Nice, no one used this email yet";
}
[/quote]
Generally speaking you should have one return point - or at least strive towards that - in any function. Alternative assessment - assigning a value to a variable that is instantly discarded is wasteful.
I'd suggest:
Code:
if ($query->num_rows() > 0) //if exist assign message as data
{
$error_message = "Sorry the email is already in used, please try again.";
}
else //else proceed to check_username()
{
$error_message = "Nice, no one used this email yet";
}
return $error_message;
Alternatively, just return (in each place) the string directly - eg.
return "Sorry the email is already in used, please try again.";
For maximum brevity:
Code:
return ($query->num_rows() > 0) ? "Sorry the email is already in used, please try again." : "Nice, no one used this email yet" ;
Finally, when posting errors can you please identify the line the error occurs in - line 27 of the fragment you quoted doesn't appear to be able to generate the error you're seeing.