hi i am new to php,i am creating php login page if user is log in successfully the page must redirect to another page if failed to log in i has to show error msg here is my code but some thing going wrong here pls help me
PHP Code:
<?php
$username="root";
$password="******";
$hostname="localhost";
$dbhandle=mysql_connect($hostname,$username,$password);
$selected=mysql_select_db("ninepixel",$dbhandle);
$username=$_POST['username'];
$password=$_POST['password'];
$username=stripslashes($username);
$password=stripslashes($password);
$query="select * from users where username='$username' and password='$password'";
$result=mysql_query($query);
if(mysql_num_rows($result)==1){
header('location:userpage.php');
exit();
}
else{
header('location:signinform.php');
exit();
}
?>
Bookmarks