1

Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

I've this error happens after I cleared my database... how would I rewrite it properly. Right now the coding assumes there will always be data which is true but since I'm starting from scratch I want to make sure its written properly.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /includes/dologin.php on line 46

//store remember-me cookie
if ($remember && @mysql_num_rows($result) == 0) {
        setcookie('remember','',time()-360000,constant('dir'));
        }

//require image for login?
if (require_image_login == 'Yes') {
        $c = @mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt 
        FROM $picstable WHERE i_status=2 AND i_user='$line[m_id]'"));
        $images = $c['cnt'];
        } else {
        $images = 1;
        }

if (mysql_num_rows($result) == 0) { // <----- this is line 46
        //unsuccessful login
        $en['login_message'] = '<strong>Login Failed!</strong> - Your Member name and/or Password was entered incorrectly.';
        if (isset($_COOKIE['remember'])) {
        setcookie('remember','',time() - 360000,constant('dir'));
        }
        load_template(tpl_path.'login.tpl');
}
Community
  • 1
  • 1
acctman
  • 4,229
  • 30
  • 98
  • 142
  • 1
    Remove all the `@` from your `mysql_*` calls. Most likely your first query, before the first usage of `mysql_num_rows()` failed. – Michael Berkowski Dec 13 '11 at 21:24
  • Where is the query you assigned to $result? That is likely the invalid query. – Brian Dec 13 '11 at 21:26
  • thanks @Michael removing the @ 's helped... I had a field called m_confirmed that I removed from the database and the sql query needed updating – acctman Dec 13 '11 at 21:39

1 Answers1

1

You've got no $result in your code, you probably mean

if ($images == 0) { // <----- this is line 46
Martin.
  • 10,494
  • 3
  • 42
  • 68