leocolomb / cli-db-iterator
Interface for iterating through a SQL selection
Fund package maintenance!
LeoColomb] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.
[user1
user2
Patreon
Requires
- symfony/console: 3.2.9
This package is auto-updated.
Last update: 2021-10-24 13:59:45 UTC
README
Interface for iterating through a SQL selection
Usage
$ composer require leocolomb/cli-db-iterator
Example
require_once __DIR__ . '/vendor/autoload.php'; use CLIDatabaseIterator\Iterator; $bridge = new Iterator("SELECT `ID`, `content` FROM `data`;"); while ($row = $bridge->fetch()) { $bridge->query("UPDATE `data` SET `content`='new content' WHERE `ID`={$row['ID']};", true); $bridge->alert("Updated!", $row['ID']); } $bridge->finish();
See wordpress-thumbnails for a real example.
License
ISC © Léo Colombaro