|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a db with a LOT of customers, but the problem is i want all the passwords of these customers md5'd - nothing i'd do manually anyway
now i tried to make a script in php to do this with ease, but it doesnt actually work - i tried the following Code:
$query = "SELECT * FROM customers";
$result = mysql_query($query, $conn) or die('error making query');
while ($res = mysql_fetch_array($result))
{
mysql_query("UPDATE customers SET customers_password = " . md5($res['customers_password']) " WHERE customers_id = " . $res['customers_id']);
}
well, for you its prolly obvious why it doesnt work, but can someone show me how it is done properly? : ) |
|
#2
|
||||
|
||||
|
What type of error are you getting?
You could try the MYSQL query: UPDATE customers SET customers_password=PASSWORD(customers_password) If there's no where clause, it *should* update the entire table... I'd try that on a test database first as i'm not positivly sure that it would give proper results =) |
|
#3
|
|||
|
|||
|
oops
simply forgot a ' and a .
i was told the errors were surpressed by the server, so i couldn't see what i was doing wrong : ) terribly sorry for wasting a post on this, but thanks anyway =) |
|
#4
|
||||
|
||||
|
its not wasting a post...
your errors and corrections may help others with similar problems... its great to see people solve their own questions! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > md5'ing all passwords |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|