PDA

View Full Version : Importing Member Database via PHPMyAdmin


keith1995
11-28-2005, 06:21 PM
I have a member database which contains usernames, password, names, contact info, etc.

I have been able to successfully import it into MySQL via PHPMyAdmin, my question is how do I turn the passwords column into a MD5 value for each of the 5215 rows? The passwords in the spreadsheet are their raw values. I need them to be MD5 values.

Is there something that I can do in PHPMyAdmin to edit the passwords column to turn them into MD5 values or is there something that I should do with the spreadsheet before importing it?

whizard
11-28-2005, 08:16 PM
You could write a script that would go through the DB and md5 all the entries, and run that once.

HTH
Dan

Velox Letum
11-28-2005, 08:23 PM
You could probably write an UPDATE query as well:

UPDATE users SET password=MD5(password)

Or something like that...but I'm not sure if that'll work without a WHERE clause.

keith1995
11-28-2005, 09:37 PM
whizard,

Could you aid me in the script to do as you explained?

Velox Letum,

I thought of something similar but I don't think that will work as I need to pull the actual password from the column to MD5 it and return the encrypted value.

whizard
11-28-2005, 11:58 PM
I will do that as soon as I get home. I'm sorry, but I am a little short on time right now. I hope I will be able to get a solution to you soon.

Dan

Velox Letum
11-29-2005, 01:21 AM
That query works fine, as it is using the table name for the function value. I just tested the query, and it runs through row-by-row and updates the password field with a MD5'd value of its self.

whizard
11-29-2005, 04:26 AM
That should solve your problem

Dan

keith1995
11-29-2005, 09:01 AM
Velox Letum,

Thanks. It worked perfectly. I didn't think it would be that simple. Guess I should have tried it before wasting everyone's time.

Thanks again!

whizard
11-29-2005, 03:53 PM
keith1995: you didnt waste anyone's time! Your question was quite a model one, providing enough info to understand what it was you wanted. Everyone here loves to help people with problems they have.

Dan:)