Why is this code not working?
It always go in else and set $_SESSION['wronglogin']=1; it is a login script which takes input of email-id and password and then checks that if any such thing exists then it should start $_SESSION['loggedin'] otherwise $_SESSION['wronglogin']. I have tried a lot but i am just not getting it
$_SESSION['login-id']=$loginid;
$_SESSION['loginpassword']=$loginpassword;
$loginid = stripslashes($loginid);
$loginpassword = stripslashes($loginpassword);
$loginid = mysql_real_escape_string($loginid);
$loginpassword = mysql_real_escape_string($loginpassword);
$con = mysql_connect("localhost", "moodabsz_naman", "database") or die(mysql_error());
mysql_select_db("moodabsz_database",$con) or die(mysql_error());
$sql="SELECT *
FROM user
WHERE `email_id` = '$loginid'
AND `password` = '$loginpassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
$_SESSION['loggedin']=1;
mysql_close($con);
header('location: index.php');
}
else {
$_SESSION['wronglogin']=1;
echo "Wrong Username or Password";
mysql_close($con);
header('Location: index.php');
}