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 7176321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:29:00+00:00 2026-05-28T16:29:00+00:00

Every time I try to run my script I get this error, saying that

  • 0

Every time I try to run my script I get this error, saying that mysql_num_rows(): supplied argument is not a valid MySQL result resource. I’m not quite sure why its doing this. My goal is to get it to check to see if the client who logs in is an admin.

<?php
    session_start();
    $username = $_POST['username'];
    $password = $_POST['password'];

    if ($username&&$password)
    {

    $user = $_SESSION['user'];
    //connect
    $connect = mysql_connect("localhost","*******_robert","***********") or die ("Couldn't Connect"); //host,username,password
    mysql_select_db("virtua15_gateway") or die ("Could not find database");
    //query
    $get = mysql_query("SELECT * FROM Users WHERE username='$user'");
    $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)
        {
         header( 'Location: index2.php' );
         $_SESSION['username']=$dbusername;
        }
        else
            echo "incorrect username and password";
    }
       else
         die ("This user does not exist");

    }
    else
        die("Please enter a username and a password");


    while($get = mysql_fetch_assoc($get))

{
 $admin = $row['admin'];
}
if ($admin==0)
 die ("You are not and admin!");
header('Location: index2.php')

?>
  • 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-05-28T16:29:02+00:00Added an answer on May 28, 2026 at 4:29 pm
    $get = mysql_query("SELECT * FROM Users WHERE username='$user'");
    $numrows = mysql_num_rows($query);
    

    So, is it $get or $query?

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

Sidebar

Related Questions

I get the following error in Chrome every time I try to run my
Every time I try to run a small application that uses a Derby DB
I have a script that relies on ENTER_FRAME event to run every time. I
I have a SQL script that has to be run every time a client
I'm using VS2008 (with windows XP). Every time I try to run a unit
I have a Visual Studio 2005 solution. Every time I try to run the
I am getting a conversion error every time I try to submit a date
I have one particular FLA that is crashing every time I try to compile
I get an exception every time I try to create a container for the
Every time I start Visual Studio 2008, the first time I try to run

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.