hi everyone,
i just want to ask is there any mistake in my code..because whenever i comment the email check it wroks fine but with email check it always gives error that this email already exists.. i am actually checking if the email im going to add is present already or not..
heres my code of action script
<?php include("../includes/config.php");?>
<?php
$fname=$_POST['firstname'];
$lname=$_POST['lastname'];
$type=$_POST['type'];
$email=$_POST['email'];
$pwd=$_POST['password'];
$image=$_FILES['image'];
$intro=$_POST['intro'];
$qualification=$_POST['qualification'];
$recoverykey=md5(time());
$encpwd=md5($pwd);
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$check= mysql_query("SELECT FROM accounts WHERE (email='".$email."')");
$result = mysql_num_rows($check);
if($result !== 0)
{
echo header("Location:manage-users.php?status=3");
}
else
{
$sql=("INSERT INTO accounts VALUES (NULL,'".$email."','".$encpwd."','".$fname."','".$lname."','".$type."','".$recoverykey."','".$image."','".$intro."','".$qualification."')");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else {
header("Location:manage-users.php?status=1");
}
}
mysql_close($con);
?>
any kind of help will be appreciated :)