Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:49:21+00:00 2026-06-13T16:49:21+00:00

I am getting this error when my login.php file loads.. ‘Warning: mysql_num_rows(): supplied argument

  • 0

I am getting this error when my login.php file loads..
‘Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource’
Heres what i have..

$query = mysql_query("SELECT * FROM users WHERE username='$username'");
$numrows = mysql_num_rows($query);
if($numrows!=0)
{
while ($row = mysql_fetch_assoc($query))
{
    $dbusername = $row['username'];
    $dbpassword = $row['password'];
}
if ($username==$dbusername&&$password==$dbpassword)
{
    echo "Youre in!";
}
else
    echo "Incorrect Password!";
}
else
    die("That user doesnt exist!");
}
else
die("Please enter a username and a password!");
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:49:22+00:00Added an answer on June 13, 2026 at 4:49 pm

    You missed some curly brackets:

    $query = mysql_query("SELECT * FROM users WHERE username='$username'");
    $numrows = mysql_num_rows($query);
    if($numrows!=0)
    {
        while ($row = mysql_fetch_assoc($query))
        {
            $dbusername = $row['username'];
            $dbpassword = $row['password'];
        }
        if ($username==$dbusername&&$password==$dbpassword)
        {
            echo "Youre in!";
        }
        else
            echo "Incorrect Password!";
        }
    } else // <- THIS ONE
        die("That user doesnt exist!");
    }
    // And here another, in a if condition that isn't started in the code you give.
    else
    die("Please enter a username and a password!");
    ?>
    

    The server could be configured that if an error shows up, the page is left blank.

    Some other tips for mySQL login: Never ever put an user input directly in a MySQL query statement! It is then very easy to hack your site by means of SQL injection.

    For more details: http://www.derby-web-design-agency.co.uk/blog-post/how-to-create-a-secure-login-system-in-php-part-1/12/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to figure why I am getting this error. **Warning: require_once(\C\wamp\www\PHP with
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
I am getting this error, Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: Invalid expression . Searched in internet
I'm getting Fatal error: Class 'Form_Login' not found in /route/to/project/application/controllers/AuthController.php on line XX when
I'm making a login script and I keep getting this error Parse error: syntax
I am getting Parse error: syntax error, unexpected ',' in /xxx/login.php on line 28
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Getting this error when try to add an item to my repositories/context: Collection has
Am getting this error message and matched my brackets and couldn't find anything wrong.
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.