Jump to content

Recommended Posts

Hello,

 

I have this code here:

 

        while ($row = mysqli_fetch_row($results))        {        //If Admin name = md5 mysql recorded version        if (md5($password) == $row[2])        {          echo "All good!";                  }else{                        echo "wrong username/password!";        }

 
I would like to use $row['password']; in stead of $row[2] but it is not working, I am worried to one day have the array 2 changing position and would prefer use the actual column name instead, how do to this please? My column name is "password".
 
Thank you,
 
Ben

If the position of the password column may be a problem in future then it sounds like your query is using "SELECT * ".

 

Don't. Specify the required columns.

 

If you had, say, "SELECT id, username, password" it would not matter what the order of columns is in the table (so long as you don't actually drop any the used columns)

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.