Hi,
Below is my PHP code and there is error says "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in H:\wamp\www\My_Project\login_action.php on line 29
which is at $sel_user=mysql_query("select * from registration where username='$id'");
<?php
session_start();
$host="localhost";
$user="root";
$pass="";
$db_name="myproject_db";
$link=mysql_connect($host,$user,$pass);
if(!$link)
{
echo "Database not connected";
die ('Could not connect to database' .mysql_error());
}
$id = $_POST['login_uname'];
$pwd = $_POST['login_pwd'];
$enc_ps = md5($pwd);
$sel_user=mysql_query("select * from registration where username='$id'");
if(!$sel_user)
echo "No user found";
while($row=mysql_fetch_array($sel_user))
{
if($row['username']==$id && $row['password']==$enc_ps)
{
$_SESSION['logged_user']= $id1; //save user in session variable
header('Location:index.php');
}
else{
echo "Invalid Username or Password";
break;
}
}
?>
Please help me on this...
Regards,
AJ