query("SELECT * FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and typ=11 OR kw='".$kw."' and jahr='".$jahr."' and typ=14 ORDER BY tour"); while($row = $ab_tour->fetch_assoc()) { $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); if($row_tour['utyp']==1) { $newabnr=$row['tour']+2000; $abvorgewicht=150; $GLOBALS['mysql']->insert("INSERT INTO tourenliste (tour,zeit,gewicht,kw,tag,monat,jahr,typ,fahrer,auto,infotext,logid) VALUES( '".$newabnr."', '".$row['zeit']."', '".$abvorgewicht."', '".$row['kw']."', '".$row['tag']."', '".$row['monat']."', '".$row['jahr']."', '".$row['typ']."', '".$row['fahrer']."', '".$row['auto']."', '".$row['infotext']."', '".time()."') "); } } } else { $ab_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and typ=11 ORDER BY tour"); while($row = $ab_tour->fetch_assoc()) { $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); if($row_tour['utyp']==1) { $newabnr=$row['tour']+2000; $GLOBALS['mysql']->query("DELETE FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and tour='".$newabnr."' "); } } } } if(isset($_POST['amtsblatt2'])) {//funst if(isset($_POST['ablatt2'])) { $ab_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and typ=11 ORDER BY tour"); while($row = $ab_tour->fetch_assoc()) { $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); if($row_tour['utyp']==2) { $newabnr=$row['tour']+2000; $abvorgewicht=150; $GLOBALS['mysql']->insert("INSERT INTO tourenliste (tour,zeit,gewicht,kw,tag,monat,jahr,typ,fahrer,auto,infotext.logid) VALUES( '".$newabnr."', '".$row['zeit']."', '".$abvorgewicht."', '".$row['kw']."', '".$row['tag']."', '".$row['monat']."', '".$row['jahr']."', '".$row['typ']."', '".$row['fahrer']."', '".$row['auto']."', '".$row['infotext']."'), '".time()."' "); } } } else { $ab_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and typ=11 ORDER BY tour"); while($row = $ab_tour->fetch_assoc()) { $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); if($row_tour['utyp']==2) { $newabnr=$row['tour']+2000; $GLOBALS['mysql']->query("DELETE FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and tour='".$newabnr."' "); } } } } //------------------- NEU ---------------------------------------------- //---------------------------------------------------------------------- //------------------------------------------ komplette Tabelle speichern if(isset($_POST['testsave'])) { foreach($_POST['list'] as $row) { $teilen1 = explode(".",$row['datum']); $tag=$teilen1[0]; $monat=$teilen1[1]; $jahr=$teilen1[2]; $datum1=$tag.".".$monat.".".$jahr; $GLOBALS['mysql']->insert("UPDATE tourenliste SET zeit='".$row['zeit']."',tag='".$teilen1[0]."',monat='".$teilen1[1]."',jahr='".$teilen1[2]."',infotext='".$row['infotext']."',logid='".time()."' WHERE id='".$row['tid']."'"); if ($row['tnr']<2000) { $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$row['gewicht']."',gewicht3='".$row['gewicht3']."',gewicht4='".$row['gewicht4']."' WHERE id='".$row['tid']."'"); } $newtnr=$row['tnr']+2000; $GLOBALS['mysql']->insert("UPDATE tourenliste SET gewicht='".$row['gewicht3']."' WHERE kw='".$row['kw']."' and jahr='".$row['jahr']."' and tour='".$newtnr."'"); } $success[]='Alle Touren wurden geändert.'; $template->assign('success', $success); } //------------------------------------- MPV Werbung //------ amtsblatt ja / nein $abla = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE typ=11 and tour>2000 and tour<3800 and kw='".$kw."' and jahr='".$jahr."'"); if($abla['num_rows'] == 0) { $amtsbl=0; }else{ $amtsbl=1; } $ablb = $GLOBALS['mysql']->query_single("SELECT * FROM tourenliste WHERE typ=11 and tour=3808 and kw='".$kw."' and jahr='".$jahr."'"); if($ablb['num_rows'] == 0) { $amtsbl2=0; }else{ $amtsbl2=1; } //------------------------------------- $key=0; $rs_tour = $GLOBALS['mysql']->query("SELECT * FROM tourenliste WHERE kw='".$kw."' and jahr='".$jahr."' and typ=11 OR kw='".$kw."' and jahr='".$jahr."' and typ=14 ORDER BY tour"); while($row = $rs_tour->fetch_assoc()) { $werb_tour3[$key]['id']=$row['id']; $werb_tour3[$key]['tnr']=$row['tour']; $werb_tour3[$key]['datum']=$row['tag'].".".$row['monat'].".".$row['jahr']; $werb_tour3[$key]['tid']=$key; $row_tour = $GLOBALS['mysql']->query_single("SELECT * FROM touren WHERE id='".$row['tour']."'"); $werb_tour3[$key]['tour']=$row_tour['tour']; $werb_tour3[$key]['utyp']=$row_tour['utyp']; //---------------- $werb_tour3[$key]['zeit']=$row['zeit']; $werb_tour3[$key]['gewicht']=$row['gewicht']; $werb_tour3[$key]['gewicht3']=$row['gewicht3']; $werb_tour3[$key]['gewicht4']=$row['gewicht4']; $werb_tour3[$key]['infotext']=$row['infotext']; $key++; } $template->assign('amtsbl', $amtsbl); $template->assign('amtsbl2', $amtsbl2); $template->assign('jahr', $jahr); $template->assign('kw', $kw); $template->assign('datum', $datum); $template->assign('werb_tour3', $werb_tour3); $template->assign('content', 'tpl/iwerbung.tpl'); ?>