prepare('SELECT * FROM emails'); $q->execute(); while ($r = $q->fetch(PDO::FETCH_OBJ)) { echo "Updating email id $r->id\n"; $stmt = $pdo->prepare("UPDATE emails SET body=?, bodyhtml=?, subject=? WHERE id='$r->id'"); $stmt->execute([iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $r->body),iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $r->bodyhtml),iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $r->subject)]); } } ?>