phpretard Posted November 14, 2008 Share Posted November 14, 2008 I keep getting a time out. I have about 80K emails I am trying to assign an md5 to a field called "surveyID" Ideally my DB would look like this in the end if I only had one email. | id | Email | surveyID | 1 me@me.com f620f4647fb816073c9152a284245e64 There are 80K emails All I have is the id and email field so far. I want to assign a md5 for each email. So I am trying to update my database (just the surveyID field with an md5 based on the corresponding email) Here is my screwy code: include ("connect.php"); $result = mysql_query("SELECT * FROM survey_lender WHERE surveyID='' "); $num_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $ID=$row['id']; $email=$row['Email']; $MD5=md5($email); if ($num_rows >= 0){ mysql_query("UPDATE survey_lender SET surveyID='$MD5' WHERE Email='$email' and id='$ID' "); } } // CLOSE WHILE mysql_close($con); I know someone has the magic code I can't find or figure out. Thanks for your help! Anthony Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 14, 2008 Share Posted November 14, 2008 Try this query UPDATE survey_lender SET surveyID = MD5(Email); should update all your rows on one go Quote Link to comment Share on other sites More sharing options...
phpretard Posted November 14, 2008 Author Share Posted November 14, 2008 Great Forum Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.