PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i m trying to validate the email address before entering into the database ....
problem....its giving error in emailid field irrespective of whether id is right or wrong.
this is wat i created...plz help ...and when u make corrections plz highlight wat u added n wat u removed in different colors so i can easily understand...thanx i m getting the error as follows
Notice: Undefined variable: emailid in D:\wamp\www\php_stockphotos\new_user.php on line 35
Warning: ereg() [function.ereg]: REG_BADRPT in D:\wamp\www\php_stockphotos\new_user.php on line 35
if ( empty($errors) )
{
if ( ereg ($pattern,$emailid))
{
$query = "INSERT INTO users (username, hashed_password, emailid
)
VALUES ('{$username}', '{$hashed_password}', '{$emailid}'
)";
$result = mysql_query($query, $connection);
if ($result) {
$message = "Request for your account has been sent to the admin...wait for ";
$message .= "email confirmation";
$username = "";
$password = "";
$emailid = "";
redirect_to('basic.php');
}
else {
$message = "The user could not be created.";
}
}
else
{
$message = "Enter a valid email address";
}
else
{
if (count($errors) == 1) {
$message = "There was 1 error in the form.";
} else {
$message = "There were " . count($errors) . " errors in the form.";
}
}
Last edited by angelic_devil on Sat Apr 04, 2009 4:46 pm, edited 6 times in total.
now its accepting all its not checking the validity of email
Database query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'hashed_password ='028298f9uhh9urh' LIMIT 1' at line 1
Last edited by angelic_devil on Sat Apr 04, 2009 4:45 pm, edited 1 time in total.