// Truncate UOM table to start fresh try { $pdo->exec("TRUNCATE TABLE uom_cache"); // Change to uom_cache_new file_put_contents($logFile, "UOM table truncated\n", FILE_APPEND); } catch (Exception $e) { file_put_contents($logFile, "Note: Could not truncate UOM table: " . $e->getMessage() . "\n", FILE_APPEND); } // Prepare insert statement $insertStmt = $pdo->prepare(" INSERT INTO uom_cache_new // This is correct (hs_code, annexure_id, uom_value, uom_description, fbr_data, last_updated) VALUES (?, ?, ?, ?, ?, NOW()) ON DUPLICATE KEY UPDATE uom_description = VALUES(uom_description), fbr_data = VALUES(fbr_data), last_updated = NOW() ");