Using MySQL queries in while() loops
Posted: Thu Sep 09, 2010 6:04 pm
Ok, a real no-brainer for the experts... 
I'm working on a DB which has all the passwords stored as plain text. What I want to do is retrieve all the passwords, convert them to SHA-256 hashes and then store them in a new field in the same table (I'm keeping both sets of passwords in there until I've updated other scripts).
The problem I'm getting is that my UPDATE query is in a while() loop and it only runs once. Rather than spend another hour trying out solutions that don't work, could anyone tell me what I'm doing wrong? I'm aware that running queries inside while() loops is sub-optimal but the script is only being run once.
Thanks in advance,
Mecha Godzilla
I'm working on a DB which has all the passwords stored as plain text. What I want to do is retrieve all the passwords, convert them to SHA-256 hashes and then store them in a new field in the same table (I'm keeping both sets of passwords in there until I've updated other scripts).
The problem I'm getting is that my UPDATE query is in a while() loop and it only runs once. Rather than spend another hour trying out solutions that don't work, could anyone tell me what I'm doing wrong? I'm aware that running queries inside while() loops is sub-optimal but the script is only being run once.
Thanks in advance,
Mecha Godzilla