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    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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.