Jump to content

Recommended Posts

I am trying to check to see if someone has registered and log them in to a site.  I am using the following syntax.

$resultID = mysql_query("SELECT * FROM user where username = '$username' AND password like '$password'", $linkID)or die(mysql_error());

If I omit the AND password like '$password'  it brings me down records but when I add this bit in  it fails everytime.  I have used this before with no problems..  

 

Any help greatly appreciated.

 

Angie

 

What do you mean by "fails". Not returning any records is not a query failure, it merely means that no records match both conditions.

 

Why are you using LIKE and not = in the password check?

Do this:

 

Execute the query without the "AND password=". Then get the record returned and do a var_dump() on the password from the DB results and do a var_dump() on the value of $password in your script. Post the results of both in this thread.

 The url is showing me that the username and password are/index.php?message=beebosoft%20nut5tretch  these are exactly the same as in the database, I have checked the name of the database and the name of the table too.

Edited by beebosoft

I have no idea what that URL you posted is supposed to be. It doesn't say anything about what the username and password are. Can you not be bothered with doing a var_dump() on the values used in the query and the values in the database? How do you "see" the values in the database? I assume you are using PHPMyADmin or some other database utility and are looking at the values displayed on the screen. What if a value had an extraneous space, or other non-printable character, at the beginning or end? Do you think you would "see" it? You are asking for help from people that do not have access to your code and database. You need to be sure to give us every opportunity to help you by providing as much relevant information as possible.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.