Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in

please i am having this error, i am trying to create a login page , but once you register it sends the email to the registered email
once the link is clicked it says the account is acitatvated but with this message below

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/reachea2/public_html/activate.php on line 11


<?php
 include 'include/global.php';

    $code = $_GET['code'];

    if (!$code)
        echo "No code supplied";
    else
    {
        $check = mysql_query("SELECT * FROM users WHERE code='$code' AND active='1'");
        if (mysql_num_rows($check)==1)
            echo "You have already activated your account";
        else
        {
            $activate = mysql_query("UPDATE users SET active='1' WHERE code='$code'");
            echo "Your account has been activated!";
        }

    }
    ?>

It means that the query has failed in some way. Use mysql_error() to tell you what the problem is.


 $check = mysql_query("SELECT * FROM users WHERE code='$code' AND active='1'")or die(mysql_error()); 

See what it says

thanks i echoed it i realised i didnt spell the table name well, so i adjusted it and it was aiit