Jump to content

SQL falling down when and statement used.


beebosoft

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

 

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.