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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:32:00+00:00 2026-05-27T23:32:00+00:00

the code below is unable to find a matching record when it should: $result

  • 0

the code below is unable to find a matching record when it “should”:

$result = mysql_query("SELECT * FROM $tbl_Name WHERE userID = '$userID' AND userKey = password('$user_password')");  // where $user_password = god12345 for example

userID comparison works fine if I remove the AND….
password comparison fails above. I am certain that when the user was created the password was hashed using password().

If I set $user_password to the actual hash stored in the data and compare literals, it works.
… AND userKey = '$user_password' // where $user_password = *29A59C23ED11F7E2510 for example

This is destroying me. Obviously I don’t want to compare literals.

  • 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-27T23:32:01+00:00Added an answer on May 27, 2026 at 11:32 pm

    Thanks to everyone who answered, particularly Mathieu who inspired me to realize my error.

    userKey VARCHAR(20) BINARY NOT NULL
    

    As of MySQL 4.1, the PASSWORD() function has been modified to produce a longer 41-byte hash value.

    So the problem was… the value stored in the dbase when I created the user was limited to 20 characters while the inputted value for login comparison was a longer 41-byte hash value.

    Prior to MySQL 4.1, password hashes computed by the PASSWORD() function are 16 bytes long.

    I was expecting the varchar(20) to hold all of the hash since the book I’m using as a guide was written in 2000….time to buy a new book.

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

Sidebar

Related Questions

I am unable to find out the bug in the below code which i
I'm unable to find the textbox control in a gridview. And the below code
In the code below, I needed to fetch an element, any element, from toSearch.
I am trying to execute the below code from a console app. ConfigurationSection aggregatedFileSection
Here's the error I'm getting with the code pasted below. Unable to create instance
I'm trying to find out why this entire code below is producing only ONE
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
Code below is working well as long as I have class ClassSameAssembly in same
The code below shows a sample that I've used recently to explain the different

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.