function vymaz_vykon($id_vykon) { $db = napoj_db(); if ($db) { $sql = <<<EOF DELETE FROM VYKON WHERE VYKON.ID_VYKON = "{$id_vykon}"; EOF; $ret = $db->exec($sql); return $ret; } return 0; }
<td><label for="priezvisko">Priezvisko</label></td> <td><input type="text" name="priezvisko" id="priezvisko" size="30" value="<?php if (isset($_POST['priezvisko'])) { echo $_POST['priezvisko']; } else { echo $po->priezvisko; } ?> "></td> </tr> <tr> <td><label for="oddiel">Oddiel</label></td> <td><select name="oddiel"> <option value="">-</option> <?php $db = napoj_db(); $sql = <<<EOF SELECT * FROM oddiely; EOF; $result = $db->query($sql); while ($row1 = $result->fetchArray(SQLITE3_ASSOC)) { echo '<option value="' . $row1['id'] . '"'; if (isset($_POST['oddiel'])) { if ($_POST['oddiel'] == $row1['id']) { echo 'selected'; } } else { if ($po->oddiel == $row1['id']) { echo 'selected'; } }
function nazov_a_datum_pretekov($id_preteku, $typ) { $db = napoj_db(); if ($db) { //echo $db->lastErrorMsg(); $sql = <<<EOF SELECT NAZOV, DATUM FROM PRETEKY WHERE ID = "{$id_preteku}"; EOF; $ret = $db->query($sql); $row = $ret->fetchArray(SQLITE3_ASSOC); if ($typ == "nazov") { echo '<input type="hidden" name="' . $typ . '" id="' . $typ . '" value="' . $id_preteku . '">' . $row["NAZOV"]; } elseif ($typ == "datum") { echo '<input type="hidden" name="' . $typ . '" id="' . $typ . '" value="' . $id_preteku . '">' . $row["DATUM"]; } $db->close(); } else { $db->close(); return; } return; }
function uprav_pouzivatela($MENO, $PRIEZVISKO, $oddiel, $OS_I_C, $CHIP, $POZNAMKA, $uspech) { $db = napoj_db(); $MENO2 = $MENO; $PRIEZVISKO2 = $PRIEZVISKO; $OS_I_C2 = $OS_I_C; $CHIP2 = strtoupper($CHIP); $POZNAMKA2 = $POZNAMKA; $uspech2 = htmlentities($uspech, ENT_QUOTES, "UTF-8"); $sql = <<<EOF UPDATE POUZIVATELIA set MENO = "{$MENO2}" where ID="{$this->id}"; UPDATE POUZIVATELIA set PRIEZVISKO = "{$PRIEZVISKO2}" where ID="{$this->id}"; UPDATE POUZIVATELIA set ID_ODDIEL = "{$oddiel}" where ID="{$this->id}"; UPDATE POUZIVATELIA set OS_I_C = "{$OS_I_C2}" where ID="{$this->id}"; UPDATE POUZIVATELIA set CHIP = "{$CHIP2}" where ID="{$this->id}"; UPDATE POUZIVATELIA set POZNAMKA = "{$POZNAMKA2}" where ID="{$this->id}"; UPDATE POUZIVATELIA set USPECH = "{$uspech2}" where ID="{$this->id}"; EOF; $ret = $db->exec($sql); if (!$ret) { echo $db->lastErrorMsg(); } else { //echo $db->changes(), " Record updated successfully\n"; } $db->close(); }
static function odstran_duplicity() { $db = napoj_db(); $sql = <<<EOF CREATE TABLE duplicity (ID INTEGER PRIMARY KEY AUTOINCREMENT, ID_POUZ TEXT NOT NULL, ID_PRET TEXT NOT NULL, KAT TEXT NOT NULL, POZNAMKA TEXT ); EOF; $db->exec($sql); $sql = <<<EOF INSERT INTO duplicity(ID_POUZ, ID_PRET, KAT,POZNAMKA) SELECT PRIHLASENY.ID_POUZ, PRIHLASENY.ID_PRET, PRIHLASENY.KAT, PRIHLASENY.POZNAMKA FROM PRIHLASENY GROUP BY ID_PRET, ID_POUZ; EOF; $db->exec($sql); $sql = <<<EOF DROP TABLE PRIHLASENY; EOF; $db->exec($sql); $sql = <<<EOF ALTER TABLE duplicity RENAME to PRIHLASENY; EOF; $db->exec($sql); // echo "Operation done successfully"."<br>"; //////////////////////////// $db->close(); }
function Pridaj_do_tab_prihlas() { $db = napoj_db(); $sql = <<<EOF INSERT INTO POUZIVATELIA ( MENO,PRIEZVISKO,OS_I_C,CHIP,POZNAMKA) VALUES ('jana', 'omg','asdasd',99,'omfg'); EOF; $ret = $db->exec($sql); if (!$ret) { echo $db->lastErrorMsg(); } else { echo "Records created successfully" . "<br>"; } $db->close(); }