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

15 lines
463 B
PHP

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