whenever i run this code i got error "undefined index" give me a solution or tell me what i have to do. code: <?php $a=$_POST['name']; $b=$_POST['password']; $con=mysql_connect("localhost","root","root"); mysql_select_db("login",$con); $res= mysql_query("select * from login where ID ='$a' AND PASS ='$b' "); if(mysql_num_rows($res)=='1') echo "YOU ARE A MEMBER"; else "incorrect id or password"; ?>
* if(mysql_num_rows($res)=='1'){ echo "YOU ARE A MEMBER";} else {echo "incorrect email id or password";}
Which line exactly does it give the error? Can you paste here the exact error? I don't see any problem as far as I can see.
Roshaan.N is right, but I guess your problem is somewhere at this line $res= mysql_query("select * from login where ID ='$a' AND PASS ='$b' "); check your DB field is same as you are mentioning in your query.