1
123123123
Guest
Sitzplan
Hallo!
Wie kann ich bei diesem Sitzplan (siehe oben PHP-CODE) die Empore links und rechts erstellen (müssen von der Bühne links und rechts liegen). Müssen die in eine extra Schleife rein oder wie?
Danke
Hier mein PHP/HTML -Code:
Das alles hab ich mit MySQL gebastelt, hier mein "erstell-code"
Danke für die Hilfe :).
Hallo!
Wie kann ich bei diesem Sitzplan (siehe oben PHP-CODE) die Empore links und rechts erstellen (müssen von der Bühne links und rechts liegen). Müssen die in eine extra Schleife rein oder wie?
Danke

Hier mein PHP/HTML -Code:
PHP:
<?php
include ("class_db.php");
$planID = 2;
$db = new DB("localhost", "", "", "plaene");
$daten = $db->getQueryData("SELECT * FROM sitzplan_{$planID}");
//p($plandaten);
?>
<html>
<head>
<title>Sitzplan <?php echo $planID?></title>
<style>
.buehne {
border: 2px solid black;
width:500px;
height:200px;
margin:10px auto;
}
h1{
text-align:center;
font-size:40px;
margin-top: 70px;
}
#feld {
border:2px solid;
width:1000px;
height:323px;
}
.plan1 {
float:left;
margin-right:10px;
}
.plan {
border-collapse: collapse;
float:left;
border-width: 5px;
text-align: center;
}
.sitz {
width:40px;
height:40px;
border-style:solid;
}
.row {
width:38px;
height:38px;
border:dotted;
background-color: #FFA54F;
}
.cat1 {
background-color: red;
}
.cat2 {
background-color: green;
}
</style>
</head>
<body>
<div class = "buehne">
<h1>Bühne</h1>
</div>
<div id = "feld">
<table class="plan1" id="plan1">
<?php
$i=0;
for($row=1; $row<=8; $row++)
{
echo "<td class='row'>{$row}</td>";
echo "<tr>";
}
?>
<table class="plan" id="plan">
<?php
$i=0;
for($row=1; $row<=8; $row++)
{
echo "<tr>";
for($seat=1; $seat<=22; $seat++)
{
$sitzdaten = $daten[$i];
echo "<td class='sitz cat{$sitzdaten['kategorie']}'>{$sitzdaten['sitz']}</td>";
$i++;
}
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>
Das alles hab ich mit MySQL gebastelt, hier mein "erstell-code"
PHP:
<?php
include ("class_db.php");
$planID = 2;
$db = new DB("localhost", "", "", "plaene");
$db->query("TRUNCATE TABLE sitzplan_{$planID}");
for ($row=1; $row<=9; $row++)
{
$x = (($row-1) * 22);
setRow($x+1, $x+11, $row, "Links", 1); setRow($x+12, $x+22, $row, "Rechts", 2);
}
function setRow($von, $bis, $reihe, $block, $kategorie)
{
global $db, $planID;
for($i=$von; $i<=$bis; $i++)
{
$db->query("INSERT INTO sitzplan_{$planID} SET
sitz = '{$i}',
reihe = '{$reihe}',
block = '{$block}',
kategorie = '{$kategorie}'");
}
}
?>
Danke für die Hilfe :).
Zuletzt bearbeitet von einem Moderator: