34849-vm/temp_update_products.php
2026-02-03 01:43:03 +00:00

25 lines
767 B
PHP

<?php
require 'db/config.php';
try {
$pdo = db();
$pdo->beginTransaction();
$updates = [
'ANILLO FENG SHUI' => 'anillo feng shui',
'CADENA SAN MIGUEL ARCANGEL' => 'cadena san miguel arcangel',
'RODILLERA DE COMPRESIÓN LARGAS AJUSTABLE POWERFLEX©' => 'rodillera de compresión largas ajustable powerflex©'
];
foreach ($updates as $upper => $lower) {
$stmt = $pdo->prepare("UPDATE products SET nombre = :upper WHERE nombre LIKE :lower");
$stmt->execute(['upper' => $upper, 'lower' => $lower . '%']);
}
$pdo->commit();
echo "Nombres de productos actualizados a mayúsculas.";
} catch (PDOException $e) {
$pdo->rollBack();
echo "Error al actualizar nombres: " . $e->getMessage();
}
?>