science-ation/db/db.update.174.php

15 lines
453 B
PHP

<?
function db_update_174_post()
{
global $config, $pdo;
$q = $pdo->prepare("SELECT * FROM users WHERE deleted = 'yes'");
while ($row = $q->fetch(PDO::FETCH_ASSOC)) {
echo 'Flagging user records prior to ? for user ? as deleted - ';
$stmt = $pdo->prepare("UPDATE users SET deleted = 'yes' WHERE uid = ? AND year < ?");
$stmt->execute([$row['year'],$row['uid'],$row['uid'],$row['year']]);
echo $pdo->rowCount() . " rows affected.\n";
}
}
?>