MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 19th, 2004, 05:45 AM
Joehaann Joehaann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Joehaann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 0
Unhappy md5'ing all passwords

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? : )

Reply With Quote
  #2  
Old November 22nd, 2004, 12:46 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
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 =)

Reply With Quote
  #3  
Old November 24th, 2004, 08:09 AM
Joehaann Joehaann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Joehaann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 0
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 =)

Reply With Quote
  #4  
Old November 24th, 2004, 08:16 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
its not wasting a post...
your errors and corrections may help others with similar problems...
its great to see people solve their own questions!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > md5'ing all passwords


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT