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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:06:17+00:00 2026-06-13T18:06:17+00:00

I am making a login page that checks for matching values in a database

  • 0

I am making a login page that checks for matching values in a database if the SELECT query returns a matching row with username and password then it will return a row count of 1. The way I have it coded right now when I echo the variable that stores the row count it will echo 26 for some reason and I’m not to sure why.

Would someone explain if I am doing something wrong or if this is normal behavior and where that value is coming from?

function checkLogin($conn,$myusername,$mypassword,$row,$row1){
   try {  
        $sql = "SELECT COUNT(*) FROM CLL_users WHERE user_name = 'user' AND password = 'XXXX'";
        if ($results = $conn->query($sql)) {

            if($results->fetchColumn() > 0) {

                $sql = "SELECT * FROM CLL_users WHERE user_name = 'user' AND password = 'XXXXX'";
                foreach ($conn->query($sql) as $row)
                {               
                   $rowCount = count($row);
                   echo $rowCount;
                    print ("Username: " . $row['user_name'] . "<br>");
                     print ("Username: " . $row['password'] . "<br>");

                    }

                    echo $count;
          }
        else {
            print "NO ROWS";
        }
        }
        } catch (PDOException $e){
    echo 'Connection failed: ' . $e->getMessage();
}

}
  • 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-13T18:06:18+00:00Added an answer on June 13, 2026 at 6:06 pm
    function checkLogin($conn,$myusername,$mypassword,$row,$row1)
    {
       try
       {  
           $sql = "SELECT COUNT(*) FROM CLL_users WHERE user_name = 'user' AND password = 'XXXX'";
           if ($results = $conn->query($sql))
           {
    
               $count = $results->fetchColumn();
               echo "$count\n";
    
               if($count > 0)
               {
                   $sql = "SELECT * FROM CLL_users WHERE user_name = 'user' AND password = 'XXXXX'";
                   foreach ($conn->query($sql) as $row)
                   {               
                       print ("Username: " . $row['user_name'] . "<br>");
                       print ("Username: " . $row['password'] . "<br>");     
                   }
               }
               else
               {
                   print "NO ROWS";
               }
           }
       }
       catch (PDOException $e)
       {
           echo 'Connection failed: ' . $e->getMessage();
       }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a login page for a game , That uses outextxy() for
Im making a login/logout class that logs users in, sets cookies based on user's
I have this code that makes sure your are logged in, and then making
I am making a simple web-app which requires login for the admin page. I
I have a usercontrol on a page that has a login control in it.
I am making a PHP script check.php that checks if a user is logged
I'm making a login page in JSP. I have an index.jsp page where the
I am making a login page in JSP. I have an index.jsp page where
i am autpmating a web site that have different function page. i am making
I'm interfacing a page that needs a login with mechanize. It uses some javascript

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.