0

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

I have a problem with my login form. I made a site and I run that site on xampp localhost. It usually works fine, but when I transferred files to web hosting, my login form showed this error:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given
... on line 39

My code in this line is:

$login_check = mysql_num_rows($sql);

// If login check number is greater than 0 (meaning they do exist and are activated)
if($login_check > 0){ 
    while($row = mysql_fetch_array($sql)){

Can someone please help me?

Community
  • 1
  • 1
  • Is the database and all its contents and structure the same on your remote host as it is on your local setup? – Jack M Jul 05 '12 at 21:50
  • Also, are you table names in the right case? Quite often local development is case insensitive and live hosts are case sensitive. – Timm Jul 05 '12 at 21:52
  • The function `mysql_num_rows` takes a resource, not a SQL query. Accordingly you're either passing the wrong thing to it, or its name could be improved (the variable `$sql` strongly suggests it contains a SQL query). – halfer Jul 05 '12 at 21:56

1 Answers1

2

It would be cleared if you provided the code before the line $login_check = mysql_num_rows($sql); but my guess is $sql is a mysql connection resource you got using mysql_connect(); It can be boolean if the connection failed.

So check your connection settings: mysql login, password, database name...

Sergey Eremin
  • 10,717
  • 2
  • 37
  • 44
  • Here's the code before : $sql = mysql_query("SELECT * FROM myMembers WHERE email='$email' AND password='$pass' AND email_activated='1'"); – user1505247 Jul 05 '12 at 21:55