Hi..i'm trying to make a login form, but i get the warning on the bolded line:
"Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Asigurari\login.php on line 15
Datele introduse sunt incorecte"
I suppose it's sth wrong with the query text, but i can't understand what. i need a join between 2, one to one relationship tables. if i use only the colored text it works.
session_start();
include("conectare.php");
$username = $_POST['login_username'];
$password = $_POST['login_password'];
$tip=1;
$result=mysql_query('SELECT * FROM utilizator INNER JOIN client ON utilizator.id_client=client.id_client AND utilizator.id_utilizator=client.id_utilizator WHERE id_utilizator="'.$username.'" AND parola="'.$password.'" AND tip_asigurat="'.$tip.'"');
if (mysql_num_rows($result)==0)
{
echo "Datele introduse sunt incorecte
";
}
else
{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$url = 'asigurator/index.html';
echo '';
}
?>
Thank you!
Loading

Shashank SrivastavaPosted Jun 26, 2013, 9:00 AM
The problem seems to exist in the query.
If the connection to the database is established properly, try query in this format instead:
$result=mysql_query(" SELECT * FROM utilizator INNER JOIN client ON utilizator.id_client=client.id_client AND utilizator.id_utilizator=client.id_utilizator WHERE id_utilizator='$username' AND parola='$password' AND tip_asigurat='$tip' ");