leocolomb/cli-db-iterator

This package is abandoned and no longer maintained. No replacement package was suggested.

Interface for iterating through a SQL selection

v1.0.0 2018-02-19 10:33 UTC

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