Jump to content

I can't retrieve a matching password from MySQL


djw821

Recommended Posts

I have created two forms one as a registration for which inserts user data into MySQL database and one as a login form to query and match the data for login.  The problem I have is that I can't seem to match the user_name and password when I try to use the login form.  I am Absolutley certain that  I am using the same username and passowrd as I used on the registration form.

 

Here is my code for inserting the data into the MySQL database.

 

$query = "SELECT user_id FROM registration WHERE user_name='$un'";

$result = @mysql_query ($query); // Run The Query.

if(mysql_num_rows($result) == 0) {

 

//Make the Query

$query = "INSERT INTO registration (first_name, last_name, email, user_name, password)

VALUES('$fn', '$ln', '$e', '$un', PASSWORD('$p'))";

$result = @mysql_query($query); // Run the query.

 

Here it is for the login form

 

$query = "SELECT user_id, first_name FROM registration WHERE user_name ='$un' AND password=PASSWORD('$p')";

$result = @mysql_query ($query);

$row = mysql_fetch_array ($result, MYSQL_NUM);

 

But I keep getting the message that The username and password do not match those on file and I am certain that I am usign the same ones.  Can someone please help me.

Link to comment
Share on other sites

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.