Jump to content

[SOLVED] Please Help Simplify this Code


phpretard

Recommended Posts

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    [email protected]      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

 

Link to comment
https://forums.phpfreaks.com/topic/132696-solved-please-help-simplify-this-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.