query("SET lc_time_names = 'de_DE';"); $query1 = "SELECT bid, vorname, nachname FROM gd_buchung WHERE reihe = '$reihe' AND platz = '$platz' AND tid = $tid ORDER BY nachname, vorname ASC"; $result1 = $db->query($query1) or die("Cannot execute query1"); while ($row_tn = $result1->fetch_array()) { $query_fav = $db->query("SELECT count(*) Anz FROM gd_standardsitzplatz WHERE nachname = '$row_tn[nachname]' AND vorname = '$row_tn[vorname]' AND reihe = '$reihe' AND platz = '$platz' "); $row_fav = $query_fav->fetch_array(); if($row_fav['Anz'] > 0){ # Favorit vorhanden, kann gelöscht werden $favorit = 0; }else{ # Favorit NICHT vorhanden, kann gesetzt werden $favorit = 1; } $row_tn['favorit'] = $favorit; $table_data1[] = $row_tn; } $smarty->assign('table_data1', $table_data1); $smarty->assign('koord_reihe', $reihe); $smarty->assign('koord_platz', $platz); $smarty->assign('koord_tid', $tid); } if ($action == 'del') { $bid = $_GET['bid']; $reihe = $_GET['reihe']; $platz = $_GET['platz']; $tid = $_GET['tid']; $del1 = $db->query("UPDATE gd_buchung SET reihe='', platz='' WHERE bid = $bid"); echo ""; } if ($action == 'fav') { $status = $_GET['status']; $vorname = $_GET['vorname']; $nachname = $_GET['nachname']; $tid = $_GET['tid']; if (isset($_GET['reihe'])) { $reihe = $_GET['reihe']; } else { $reihe = ''; } if (isset($_GET['platz'])) { $platz = $_GET['platz']; } else { $platz = ''; } $del1 = $db->query("DELETE FROM gd_standardsitzplatz WHERE vorname='$vorname' AND nachname='$nachname'"); if($status == 1){ $ins1 = $db->query("INSERT INTO gd_standardsitzplatz (nachname, vorname, reihe, platz) VALUES ('$nachname', '$vorname', '$reihe', '$platz')"); } echo $tid; echo ""; } $smarty->assign('action', "$action"); $smarty->display("$template/admin/$templatename"); ?>