Log in

View Full Version : login and password not working



vineet
10-25-2008, 05:40 AM
hi all i have a login form with user name and password. The user name field is called "user_name" and password field is called "password".
I have applied the code.
I m filing the right user and password.
In the database i have user_id, user_name, password.
neither an error is coming nor its redirectig it.



require_once("../config.php");

$msg="";
if(isset($_REQUEST['id']))
{
$id=$_REQUEST['id'];
$qry="select * from admin_table where user_id='$id'";
$result=mysql_query($qry);
$row=mysql_fetch_array($result);


}

if(isset($_REQUEST['submit']))
{

$user_name=$_REQUEST['user_name'];
$password=$_REQUEST['password'];

$qry="select * from admin_table WHERE user_name='$user_name' and password='$password'";
//echo $qry;

$result=mysql_query($qry);

if(mysql_num_rows($result)>0)
{

if(($user_name==$row['user_name']) && ($password==$row['password']))

{
header("Location: control_panel.php");
}
else
{
$msg="Login ID or password is incorrect";
}
}
}

rangana
10-25-2008, 07:36 AM
It's your responsibility to die() (http://us.php.net/die).

You can never see error, since you're not instructing the code to show any:


$result=mysql_query($qry) or die(mysql_error());