Files
wachter/admin/inhalte/suche_admin.php

77 lines
2.2 KiB
PHP

<form action="index.php?section=suche" method="post">
<fieldset>
<legend>Suche nach Objekt</legend>
<label>Objektnummer</label>
<input type="text" name="ID" value="<?php echo $_POST['ID']; ?>" />
<br />
<label>Kurzbeschreibung</label>
<input type="text" name="Kurz" value="<?php echo $_POST['Kurz']; ?>" />
<br />
<label>Ort</label>
<input type="text" name="Ort" value="<?php echo $_POST['Ort']; ?>" />
<br />
<input type="submit" name="Suche" value="Suchen..." />
</fieldset>
</form>
<br /><br />
<?php
if ( isset ( $_POST['Suche'] ) AND ( 'Suchen...' == $_POST['Suche'] ) )
{
$abfrage = '';
if ( !empty ( $_POST['ID'] ) )
{
$abfrage .= "ID = '" . $_POST['ID'] . "' ";
}
if ( !empty ( $_POST['Kurz'] ) )
{
if ( !empty ( $abfrage ) )
{
$abfrage .= "AND ";
}
$abfrage .= "Kurz LIKE '%" . $_POST['Kurz'] . "%' ";
}
if ( !empty ( $_POST['Ort'] ) )
{
if ( !empty ( $abfrage ) )
{
$abfrage .= "AND ";
}
$abfrage .= "Ort LIKE '%" . $_POST['Ort'] . "%' ";
}
$sql = "SELECT * FROM objekte WHERE " . $abfrage . " ORDER BY Akt_Datum DESC;";
$result = $db->query ( $sql );
$anz = $result->num_rows;
?>
<table>
<colgroup>
<col width="35px" />
<col width="50px" />
<col width="345px" />
<col width="180px" />
<col width="150px" />
</colgroup>
<tr height="30">
<th style="text-align:right;padding-right:10px;"><?php echo $anz; ?></th>
<th style="text-align:left;">O-Id</th>
<th style="text-align:left;">Kurzbeschreibung</th>
<th style="text-align:left;">Benutzer</th>
<th style="text-align:left;">Ort</th>
</tr>
<?php
while ( $nt = $result->fetch_assoc () )
{
echo "<tr>\n";
echo " <td>&nbsp;</td>\n";
echo " <td>" . $nt['ID'] . "</td>\n";
echo " <td style=\"padding-right:20px;\">" . $nt['Kurz'] . "</td>\n";
echo " <td style=\"color:blue;\">" . fnc_getUsernameById ( $nt['TID'], 'logfiles' ) . "</td>\n";
echo " <td>" . $nt['Ort'] . "</td>\n";
echo "</tr>\n";
}
?>
</table>
<?php
}