PDO::ERRMODE_EXCEPTION] ); echo "=== Encrypt m_patientaddress ===\n"; $total = 0; $batch = 500; $stmt = $pdo->prepare( "UPDATE m_patientaddress SET M_PatientAddressDescription_enc = ?, M_PatientAddressEmail_enc = ?, M_PatientAddressPhone_enc = ? WHERE M_PatientAddressID = ?" ); while (true) { $rows = $pdo->query( "SELECT M_PatientAddressID, M_PatientAddressDescription, M_PatientAddressEmail, M_PatientAddressPhone FROM m_patientaddress WHERE M_PatientAddressDescription_enc IS NULL LIMIT {$batch}" )->fetchAll(PDO::FETCH_ASSOC); if (empty($rows)) break; foreach ($rows as $row) { $stmt->execute([ $enc->encrypt((string)($row['M_PatientAddressDescription'] ?? '')), $enc->encrypt((string)($row['M_PatientAddressEmail'] ?? '')), $enc->encrypt((string)($row['M_PatientAddressPhone'] ?? '')), $row['M_PatientAddressID'], ]); $total++; } echo " {$total} rows...\n"; } echo "Selesai: {$total} rows\n";