Violeta Popa

Violeta Popa

  • 2.1k
  • 137
  • 158.7k

Warning: mysql_num_rows() expects parameter 1 to be resource

May 1 2013 1:25 AM
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.


$username = $_POST['login_username'];
$password = $_POST['login_password'];

$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<br>";

$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

$url = 'asigurator/index.html';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';  


Thank you!

Answers (1)