Ejemplo n.º 1
0
function majStatus($a_matos, $a_action)
{
    $qry = "Select groupe from materiel where materielID = {$a_matos}";
    $sqlCmdMatos = "update materiel set etat='{$a_action}' where materielID={$a_matos}";
    $sqlCmdGroupe = "update materiel set etat='{$a_action}' where groupe={$a_matos}";
    try {
        $db = new sqlite3($GLOBALS['dbaseName']);
        $result = $db->query($qry);
        $row = $result->fetchArray();
        $group = $row[0];
        if ($group == $a_matos) {
            $sqlCmd = $sqlCmdGroupe;
        } else {
            $sqlCmd = $sqlCmdMatos;
        }
        logMe("LIB : majStatus(\"{$sqlCmd}\")");
        $db->exec($sqlCmd);
        $db->close();
    } catch (Exception $e) {
        logme("ERROR : {$e}");
        return;
    }
}
Ejemplo n.º 2
0
<?php

$tableToChange = 'pages';
$db = new sqlite3("content.db");
$rs = $db->query('select showDate, expDate, id from ' . $tableToChange . ' where date(showDate) > date(expDate)');
if ($rs) {
    while ($row = $rs->fetchArray()) {
        var_dump($row);
        echo "\n\n Fixing... \n\n";
        $db->exec('update ' . $tableToChange . ' set showDate="' . $row['expdate'] . '", expDate="' . $row['showdate'] . '" where id=' . $row['id']);
        echo "Fixed";
    }
}