title: Iterate through MYSQL database and replace data in every record in one column
body: <p>I have this VERY inefficient way of updating the phone numbers in my database after cleaning them of all non-digits.</p>
  
  <pre><code>$san_phone = mysql_query('SELECT * FROM table');
  
  while ($row = mysql_fetch_array($san_phone)) {
      $row['phone_clean'] = preg_replace('#[^\d]#', '', $row['phone']);
      echo $row['id'] . ' - ' . $row['phone_clean'] . '&lt;br&gt;';
  
      mysql_query("UPDATE table SET phone = " . $row['phone_clean']  . " WHERE id = " . $row['id']);
  }
  </code></pre>
  
  <p>That update part of the loop is causing me to timeout after only about 400 of my 2,400 records.  It's obvious I'm doing something wrong so be gentle when schooling me. ;)</p>