Projekt: Hesla Jednoty bratrské/2022/functions.php
functions.php
editovatPHP funkce pro webový formulář Projekt: Hesla Jednoty bratrské/2022/index_php. Verze z 2021-05-18:
<?php
/* sirka hlavniho ramecku se nastavuje v souboru styl.css #stranka-obal - radek 23 */
/*
verze 2022.02 ze dne : 2021-01-22 (get_notice <= song)
licence: GFDL + CC-BY-SA 3.0
autor původního PHP kódu pro Hesla na rok 2009: Slávek Heřman
struktura databáze + úpravy PHP kódu pro další roky: Petr Heřman aka http://cs.wikiversity.org/wiki/User:Kychot
Upravil Matěj Heřman
*/
/* LOCALHOST */
define('DEBUG', true);
define("SERVER", "localhost");
//define("DB_NAME", "hes18petr_ori");
//define("DB_NAME", "hes18old"); // původní mirek
//define("DB_NAME", "hes18mirek"); // mirek po opravách
//define("DB_NAME", "hes19");
//define("USER", "petr");
define("PASSWORD", "blabla");
//define("DB_NAME", "hes20"); //2020
//define("DB_NAME", "hes20test"); //2020test
//define("DB_NAME", "hes21"); //2021
//define("DB_NAME", "hes21test"); //2021test
//define("DB_NAME", "hes22"); //2022
//define("DB_NAME", "hes22test"); //2022test
//define("USER", "root");
//define("PASSWORD", "");
/* DULOS */
define("USER", "dulos7146");
//define("DB_NAME", "dulos191"); //neevidována
//define("DB_NAME", "dulos343"); //neevidována
//define("DB_NAME", "dulos8551"); //2016mirek
//define("DB_NAME", "dulos9715"); //2016petr
//define("DB_NAME", "dulos1398"); //2016rfc
//define("DB_NAME", "dulos1152"); //2017mirek
//define("DB_NAME", "dulos8482"); //2017rfc
//define("DB_NAME", "dulos2827"); //2018mirek
//define("DB_NAME", "dulos2831"); //2018rfc
//define("DB_NAME", "dulos4978"); //2018honza
//define("DB_NAME", "dulos6340"); //2019petr_ori
//define("DB_NAME", "dulos4225"); //2019mirek
//define("DB_NAME", "dulos6704"); //2019rfc
//define("DB_NAME", "dulos933"); //2019test
//define("DB_NAME", "dulos2060"); //2020petr_ori
//define("DB_NAME", "dulos8549"); //2020mirek
//define("DB_NAME", "dulos5803"); //2020test
//define("DB_NAME", "dulos3212"); //2020rfc
//define("DB_NAME", "dulos2439"); //2021petr_ori
//define("DB_NAME", "dulos7760"); //2021mirek
//define("DB_NAME", "dulos6039"); //2021test
//define("DB_NAME", "dulos3002"); //2021rfc
//define("DB_NAME", "dulos2035"); //2022/test
//define("DB_NAME", "dulos3655"); //2022/petr_ori
//define("DB_NAME", "dulos5274"); //2022/Mirek
define("DB_NAME", "dulos6270"); //2022/rfc
define("DEFAULT_DATE", "2022-01-01"); /* Začátek roku */
global $db;
$db = connectDB();
// width of losung textarea in cols
$losung_width = 60;
// $losung_width = 65;
// $losung_width = 70;
$quote_width = 60;
$dny = [1 => "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota", "neděle"];
$mesice = [
1 => "leden",
"únor",
"březen",
"duben",
"květen",
"červen",
"červenec",
"srpen",
"září",
"říjen",
"listopad",
"prosinec",
];
function connectDB()
{
$spojeni = mysqli_connect(SERVER, USER, PASSWORD, DB_NAME);
if (!$spojeni) {
echo "Error: Unable to connect to MySQL – nejde se připojit k databázi :-(." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
// echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
// echo "Host information: " . mysqli_get_host_info($spojeni) . PHP_EOL;
$spojeni->query("set names 'utf8'");
return $spojeni;
}
function get_losung($title, $date, $which, $lang, $transl, $edit = true)
{
global $db;
global $losung_width;
$date = date("Y-m-d", $date);
printf("\t\t<!-- get_losung(title='%s', date='%s', which='%s', lang='%s', transl='%s', edit='%s' -->\n",
$title, $date, $which, $lang, $transl, $edit);
$query = "
SELECT * FROM `losung`
WHERE `date` = '$date'
AND `which` = '$which'
AND `lang` = '$lang'
";
if ($transl) {
$query .= " AND `transl` = '$transl'
";
}
$result = $db->query($query);
printf("\t\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows > 0) { // záznam je v databázi
$row = $result->fetch_array();
if ($edit) { // text má být editovatelný
if ($row["sel"] == 1) { // text je vybrán - má se zobrazit
echo <<<END
<table summary="heslo">
<tr>
<td><input class="intro" type='text' value='{$row["intro"]}' name='losung_{$row["date"]}_{$row["which"]}_{$row["transl"]}_intro' /><i>:</i></td>
<td rowspan="3"><textarea rows='4' cols='{$losung_width}' name='losung_{$row["date"]}_{$row["which"]}_{$row["transl"]}_text'>
{$row['text']}</textarea></td>
</tr>
<tr>
<td><strong>$title </strong><a href="{$_SERVER['PHP_SELF']}?date=$date&sel=losung_{$row["date"]}_{$row["which"]}_{$row["transl"]}_0">
<small>(zavřít)</small></a></td>
</tr>
<tr>
<td><input class="source" type='text' value='{$row["source"]}'name='losung_{$row["date"]}_{$row["which"]}_{$row["transl"]}_source' /></td>
</tr>
</table>
END;
} else { // text není vybrán - nezobrazíse, jen nabídka na zobrazení
echo "$title <a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=losung_{$row["date"]}_{$row["which"]}_{$row["transl"]}_1\" class='deselected'>\n";
echo "\t<small>(přidat)</small></a><br />";
}
} else { // text nemá být editovatelný
$transl = $row["transl"];
if ($transl == 'Lr') {$transl = '';} // Lutherův překlad nevyznačujeme
else {$transl = ' ' . $transl;}
echo (!empty($row["intro"]) ? "<em><span style="color:#A04000;">{$row["intro"]}</span></em>" : "") . "\n{$row['text']}<div class='source'>{$row['source']}{$transl}</div>\n";
}
} else { // záznam není v databází - zobrazit tlačítko pro přidání
if ($transl != "los") // pro originál nezobrazovat
{
echo "\t{$title} <a href=\"{$_SERVER['PHP_SELF']}?date={$date}&sel=losung_{$date}_{$which}_{$transl}_new\" class='deselected'>\n";
}
echo "\t<small>(přidat)</small></a><br />";
}
}
function get_quote($title, $date, $which, $lang, $transl, $edit = true)
{
global $db;
global $quote_width;
$date = date("Y-m-d", $date);
printf("\t\t<!-- get_quote(date='%s', which='%s', lang='%s', transl='%s', edit='%s' -->\n",
$title, $date, $which, $lang, $transl, $edit);
$query = "
SELECT * FROM `quote`
WHERE `date` = '$date'
AND `which` = '$which'
AND `lang` = '$lang'
";
if ($transl) {
$query .= " AND `transl` = '$transl'
";
}
$result = $db->query($query);
printf("\t\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows > 0) { // záznam je v databázi
$row = $result->fetch_array();
if ($edit) { // text má být editovatelný
if ($row["sel"] == 1) { // text je vybrán - má se zobrazit
echo <<<END
<table summary="quote">
<tr>
<td><strong>{$title}:</strong></td>
<td rowspan="2"><textarea rows='3' cols='{$quote_width}' name='quote_{$row["date"]}_{$row["which"]}_{$row["transl"]}_text'>
{$row['text']}</textarea></td>
</tr>
<tr>
<td><input class="source" type='text' value='{$row["source"]}'name='quote_{$row["date"]}_{$row["which"]}_{$row["transl"]}_source' /></td>
</tr>
</table>
END;
}
}
}
}
function get_day($title, $date, $which, $lang)
{
global $db;
$date = date("Y-m-d", $date);
printf("\t\t<!-- get_day(title='%s', date='%s', which='%s', lang='%s' -->\n", $title, $date, $which, $lang);
$query = "
SELECT * FROM `day`
WHERE `date` = '$date'
AND `which` = '$which'
AND `lang` = '$lang'
";
$result = $db->query($query);
printf("\t\t\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows > 0) {
$row = $result->fetch_array();
echo "<strong>$title: </strong>\n";
if ($row["sel"] == 1) { // text je vybrán - má zobrazit
echo "<input size='50' type='text' value='{$row["text"]}' name='day_{$row["date"]}_{$row["which"]}_{$row["lang"]}_text' />\n";
if ($which != "sunday") {
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=day_{$date}_{$which}_cs_0\"><small>(odebrat)</small></a><br />";
}
echo "<br /> (<input size='50' type='text' value='{$row["meaning"]}' name='day_{$row["date"]}_{$row["which"]}_{$row["lang"]}_meaning' />\n";
echo " odkaz: <input type='text' value='{$row["src"]}' name='day_{$row["date"]}_{$row["which"]}_{$row["lang"]}_src' />)<br />\n";
echo "<br />";
get_losung("", strtotime($date), $row["which"], 'de', false, false);
#echo "<br />";
get_losung("ekumenický", strtotime($date), $row["which"], 'cs', "cep");
get_losung("kralický", strtotime($date), $row["which"], 'cs', "kra");
get_losung("jiný", strtotime($date), $row["which"], 'cs', "oth");
get_quote("Citát", strtotime($date), $row["which"], 'cs', "MM");
} else { // text není vybrán - možnost přidat jej
echo "\t<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=day_{$date}_{$which}_cs_1\"><small>(přidat)</small></a>\n";
echo "\t<br />";
}
}
}
function get_reading($title, $date, $which)
{
global $db;
$date = date("Y-m-d", $date);
$query = "
SELECT * FROM `reading`
WHERE `date` = '$date'
AND `which` = '$which'
";
$result = $db->query($query);
if ($result->num_rows > 0) {
$row = $result->fetch_array();
echo "<label for='reading_{$row["date"]}_{$row["which"]}_{$row["lang"]}_source'>$title </label>";
echo "<input type='text' value='{$row["source"]}' name='reading_{$row["date"]}_{$row["which"]}_{$row["lang"]}_source' id='reading_{$row["date"]}_{$row["which"]}_{$row["lang"]}_source' />\n";
$row = $result->fetch_array();
echo " <em>{$row["source"]}</em><br />\n";
}
}
function display_wochenlied($nr, $text)
{
global $db;
$link_name = explode(']', $text);
$link = $link_name[0];
$name = $link_name[1];
$link = str_replace('[', '', $link);
$link = "http://www.liederdatenbank.de/song/$link";
echo "<b>EG $nr</b> <a href=\"$link\" target=\"_blank\">$name</a><br />
";
}
function wochenlied($date)
{
global $db;
$date = date("Y-m-d", $date);
printf("\t<!-- display_wochenlied(date='%s') -->", $date);
$query = "
SELECT * FROM `song`
WHERE `date` = '$date'
AND `which` = 'WL'
AND `lang` = 'de'
";
$result = $db->query($query);
printf("\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows > 0) {
$row = $result->fetch_array();
$nr = $row['nr'];
$text = $row['text'];
$nr12 = explode('|', $nr);
$text12 = explode('|', $text);
echo "Wochenlied: ";
display_wochenlied($nr12[0], $text12[0]);
if ($nr12[1]) {
echo " nebo: ";
display_wochenlied($nr12[1], $text12[1]);
}
}
}
function get_song($date, $which, $lang)
{
global $db;
$date = date("Y-m-d", $date);
printf("\t<!-- get_song(date='%s') -->", $date);
$query = "
SELECT * FROM `song`
WHERE `date` = '$date'
AND `which` = '$which'
AND `lang` = '$lang'
";
$result = $db->query($query);
printf("\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows == 0) {
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=song_{$date}_Ld_cs_new\"><small>(přidat)</small></a><br />";
} else {
$row = $result->fetch_array();
if ($row['sel'] == 0) { // nezobrazit - pouze tlačítko pro zobrazení
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=song_{$date}_Ld_cs_1\"><small>(přidat)</small></a><br />";
} else { // zobrazit celé
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=song_{$date}_Ld_cs_0\"><small>(odebrat)</small></a><br />";
echo <<<END
<textarea cols='45' rows='10' name="song_{$date}_{$which}_cs_text" id="song_{$date}_{$which}_cs_text">{$row["text"]}</textarea><br />
<label for="song_{$date}_{$which}_cs_book">jiný zpěvník </label>
<input type='text' name="song_{$date}_{$which}_cs_book" id="song_{$date}_{$which}_cs_book" value="{$row['book']}" /><br />
<label for="song_{$date}_{$which}_cs_nr">číslo písně </label>
<input type='text' name="song_{$date}_{$which}_cs_nr" id="song_{$date}_{$which}_cs_nr" value="{$row['nr']}" /><br />
<label for="song_{$date}_{$which}_cs_strophe">sloka </label>
<input type='text' name="song_{$date}_{$which}_cs_strophe" id="song_{$date}_{$which}_cs_strophe" value="{$row['strophe']}" /><br />
<label for="song_{$date}_{$which}_cs_strophe2">další sloka </label>
<input type='text' name="song_{$date}_{$which}_cs_strophe2" id="song_{$date}_{$which}_cs_strophe2" value="{$row['strophe2']}" />
END;
}
}
}
function get_notice($date)
{
global $db;
$date = date("Y-m-d", $date);
printf("\t<!-- get_notice(date='%s') -->", $date);
$query = "
SELECT * FROM `notice`
WHERE `date` = '$date'
";
$result = $db->query($query);
printf("\t<!-- notice: mysql_num_rows = %d -->\n", $result->num_rows);
if ($result->num_rows == 0) {
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=notice_{$date}_new\"><small>(přidat)</small></a><br />";
} else {
$row = $result->fetch_array();
// echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=notice_{$date}_0\"><small>(odebrat)</small></a><br />";
echo <<<END
<textarea cols='80' rows='3' name="notice_{$date}_text" id="notice_{$date}_text">{$row["text"]}</textarea><br />
END;
}
}
function get_comments($date)
{
global $db;
$date = date("Y-m-d", $date);
printf("\t<!-- get_comment(date='%s') -->", $date);
$query = "
SELECT * FROM `comment`
WHERE `date` = '$date'
AND `lang` = 'cs'
AND `sel` = 1
ORDER BY `lang` DESC
";
$result = $db->query($query);
printf("\t<!-- mysql_num_rows = %d -->\n", $result->num_rows);
// echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=comment_{$date}_x_cs_new\"><small>(přidat)</small></a>";
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=comment_{$date}_x_cs_showall\"><small>(zobrazit vše)</small></a><br />";
while ($row = $result->fetch_array()) {
echo <<<END
<input type='text' size='4' name="comment_{$date}_cs_histdatetxt_{$row['histdatetxt']}" value="{$row['histdatetxt']}" />
<input type='text' size='50' name="comment_{$date}_cs_text_{$row['histdatetxt']}" value="{$row['text']}" />
END;
echo "<a href=\"{$_SERVER['PHP_SELF']}?date=$date&sel=comment_{$date}_x_cs_0_{$row['histdatetxt']}\"><small>(odebrat)</small></a><br />";
}
echo <<<END
<input type='text' size='4' name="comment_{$date}_cs_histdatetxt_new" value="" />
<input type='text' size='50' name="comment_{$date}_cs_text_new" value="" />
END;
}
function save_all($date)
{
global $db;
$date = date("Y-m-d", $date);
// losungen
$whiches = ['YEAR', 'MONTH', 'NT', 'OT', 'sunday', 'holiday', 'important', 'week'];
$transls = ['cep', 'kra', 'oth'];
foreach ($whiches as $which) {
foreach ($transls as $transl) {
if (isset($_POST["losung_{$date}_{$which}_{$transl}_text"])) {
$query = "
UPDATE `losung`
SET
`intro`='" . $db->real_escape_string($_POST["losung_{$date}_{$which}_{$transl}_intro"]) . "',
`text`='" . $db->real_escape_string($_POST["losung_{$date}_{$which}_{$transl}_text"]) . "',
`source`='" . $db->real_escape_string($_POST["losung_{$date}_{$which}_{$transl}_source"]) . "'
WHERE `date`='{$date}' AND `which`='{$which}' AND `transl`='{$transl}'";
$db->query($query);
}
}
}
// quotes
$whiches = ['YEAR', 'MONTH', 'NT', 'OT', 'sunday', 'holiday', 'important', 'week'];
$transls = ['MM'];
foreach ($whiches as $which) {
foreach ($transls as $transl) {
if (isset($_POST["quote_{$date}_{$which}_{$transl}_text"])) {
$query = "
UPDATE `quote`
SET
`text`='" . $db->real_escape_string($_POST["quote_{$date}_{$which}_{$transl}_text"]) . "',
`source`='" . $db->real_escape_string($_POST["quote_{$date}_{$which}_{$transl}_source"]) . "'
WHERE `date`='{$date}' AND `which`='{$which}' AND `transl`='{$transl}'";
$db->query($query);
}
}
}
// days
$whiches = ['sunday', 'holiday', 'important', 'week'];
foreach ($whiches as $which) {
if (isset($_POST["day_{$date}_{$which}_cs_text"])) {
$query = "
UPDATE `day`
SET
`meaning`='" . $db->real_escape_string($_POST["day_{$date}_{$which}_cs_meaning"]) . "',
`text`='" . $db->real_escape_string($_POST["day_{$date}_{$which}_cs_text"]) . "',
`src`='" . $db->real_escape_string($_POST["day_{$date}_{$which}_cs_src"]) . "',
`sel`='1'
WHERE `date`='{$date}' AND `which`='{$which}' AND `lang`='cs'";
$db->query($query);
}
}
// readings
$whiches = ['SR', 'CR', 'Ev', 'Ep', 'Ps', 'Pr'];
foreach ($whiches as $which) {
if (isset($_POST["reading_{$date}_{$which}_cs_source"])) {
$query = "
UPDATE `reading`
SET
`source`='" . $db->real_escape_string($_POST["reading_{$date}_{$which}_cs_source"]) . "',
`sel`='1'
WHERE `date`='{$date}' AND `which`='{$which}' AND `lang`='cs'";
$db->query($query);
}
}
// song
if (isset($_POST["song_{$date}_Ld_cs_text"])) {
$query = "
UPDATE `song`
SET
`book`='" . $db->real_escape_string($_POST["song_{$date}_Ld_cs_book"]) . "',
`nr`='" . $db->real_escape_string($_POST["song_{$date}_Ld_cs_nr"]) . "',
`strophe`='" . $db->real_escape_string($_POST["song_{$date}_Ld_cs_strophe"]) . "',
`strophe2`='" . $db->real_escape_string($_POST["song_{$date}_Ld_cs_strophe2"]) . "',
`text`='" . $db->real_escape_string($_POST["song_{$date}_Ld_cs_text"]) . "'
WHERE `date`='$date'
AND `which`='Ld'
AND `lang`='cs'
";
$db->query($query);
}
// notice
if (isset($_POST["notice_{$date}_text"])) {
$query = "
UPDATE `notice`
SET
`text`='" . $db->real_escape_string($_POST["notice_{$date}_text"]) . "'
WHERE `date`='$date'
";
$db->query($query);
}
// comment
$comments = [];
foreach ($_POST as $key => $value) {
if (strpos($key, 'comment') === false) {
continue;
}
list($commentType, $commentDate, $commentLang, $commentField, $commentHistTxt) = explode('_', $key);
if (!array_key_exists($commentHistTxt, $comments)) {
$comments[$commentHistTxt] = new stdClass();
}
if ($commentField === 'text') {
$comments[$commentHistTxt]->text = $db->real_escape_string($value);
} else {
$comments[$commentHistTxt]->histdatetxt = $db->real_escape_string($value);
}
$comments[$commentHistTxt]->date = $commentDate;
}
foreach ($comments as $histtxt => $comment) {
if ($histtxt == 'new' && $comment->histdatetxt && $comment->text) {
$query = "INSERT INTO comment(`sel`, `date`, `lang`, `histdatetxt`, `text`) VALUES('1', '$date', 'cs', '$comment->histdatetxt', '$comment->text')";
} else {
$query = "
UPDATE `comment`
SET
`text`='" . $comment->text . "',
`histdatetxt`='" . $comment->histdatetxt . "',
`date`='" . $comment->date . "'
WHERE `date`='{$comment->date}' AND `histdatetxt`='{$comment->histdatetxt}' AND `lang`='cs'";
}
$db->query($query);
}
}
function sel()
{
global $db;
$parameters = explode("_", $_REQUEST['sel']);
// echo 'REQUEST: ' . $_REQUEST['sel'];
// echo 'PARAMETRES: ' . $query;
// echo 'COUNT:' . (count($parameters);
if (count($parameters) === 3) {
list($table, $date, $value) = $parameters;
} elseif (count($parameters) === 5) {
list($table, $date, $which, $transl, $value) = $parameters;
} elseif (count($parameters) === 6) {
list($table, $date, $which, $transl, $value, $histdatetxt) = $parameters;
} else {
echo 'Špatný počet parametrů pro select';
}
switch ($table) {
case "losung":
if ($value == "new") {
// $query = "INSERT INTO `$table`(`sel`, `date`, `which`, `lang`, `transl`, `source`, `intro`, `text`) VALUES('1', '$date', '$which', 'cs', '$transl', '', '', '')";
$query = "INSERT INTO `$table`(`sel`, `date`, `seq`, `which`, `lang`, `transl`, `source`, `intro`, `text`)
VALUES('1', '$date', 99, '$which', 'cs', '$transl', '', '', '')"; // 99 – nebyla vložena regulérní hodnota `seq`
} else {
$query = "UPDATE `$table` SET `sel`='$value' WHERE `date`='{$date}' AND `which`='{$which}' AND `transl`='$transl'";
}
break;
case "song":
if ($value == "new") {
$query = "INSERT INTO song(`sel`, `date`, `which`, `lang`) VALUES('1', '$date', '$which', '$transl')";
} else {
$query = "UPDATE `$table` SET `sel`='$value' WHERE `date`='{$date}' AND `which`='{$which}' AND `lang`='$transl'";
}
break;
case "notice":
if ($value == "new") {
$query = "INSERT INTO notice(`date`) VALUES('$date')";
}
// else {
// $query = "UPDATE `$table` SET `sel`='$value' WHERE `date`='{$date}' AND `which`='{$which}' AND `lang`='$transl'";
// }
break;
case "comment":
if ($value == "new") {
$query = "INSERT INTO comment(`sel`, `date`, `lang`, `text`) VALUES('1', '$date', '$transl', '')";
echo $query;
} elseif ($value == 'showall') {
$query = "UPDATE `$table` SET `sel`='1' WHERE `date`='{$date}' AND `lang`='$transl'";
} else {
$query = "UPDATE `$table` SET `sel`='$value' WHERE `histdatetxt`='{$histdatetxt}' AND `lang`='$transl' AND `date`='$date'";
}
break;
case "day":
$query = "UPDATE `$table` SET `sel`='$value' WHERE `date`='{$date}' AND `which`='{$which}' AND `lang`='{$transl}'";
break;
}
$result = $db->query($query);
if (DEBUG) {
if ($result === true) {
// echo 'QUERY: ' . $query;
// echo ' proběhla v pořádku<br>';
// echo 'změněných řádků: ' . $db->affected_rows;
} else {
echo 'QUERY: ' . $query;
echo ' proběhla s chybou<br>';
echo 'chyba: ' . $db->error . '<br>';
}
}
}