AppStateESS/homestead

View on GitHub
contrib/createRoomUniqueId.php

Summary

Maintainability
B
5 hrs
Test Coverage
#!/usr/bin/php
<?php

require_once('cliCommon.php');
require_once('dbConnect.php');

ini_set('display_errors', 1);
ini_set('ERROR_REPORTING', E_WARNING);
error_reporting(E_ALL);

$args = array('term' => '');

$switches = array();
check_args($argc, $argv, $args, $switches);

$db = connectToDb();

$query = "SELECT * FROM hms_room WHERE term = {$args['term']}";
$result = pg_query($query);

while ($room = pg_fetch_array($result)){
    $sql = "UPDATE hms_room SET persistent_id = '" . uniqid() . "' where id = {$room['id']} and term = {$args['term']}";
    pg_query($sql);
}

pg_close($db);