<?php session_start(); ob_start();

include("connect.php");
include("login_cookie.php");


$get_all_things = mysql_query("SELECT * FROM `pytox_tingliste`") or die(mysql_error());
?>
Der er i alt <?=mysql_num_rows($get_all_things)?> ting
<br />
<br />
<select name="type" onchange="top.location= '<?=$_SERVER['PHP_SELF']?>?site=Tingliste&type='+this.value;">
<option selected="selected">Vælg en kategori</option>
<?php
$get_types = mysql_query("SELECT * FROM `pytox_tingtyper` ORDER BY `priority` DESC") or die(mysql_error());

while ($type = mysql_fetch_array($get_types)) {
?>
<option value="<?=$type['typeid']?>"><?=$type['name']?></option>

<?php
}
?>
</select>
<br />
<br />
<?php
if ($_GET['type'] != "") {

print "Følgende ting blev fundet:<br /><br />";

$get_the_items = mysql_query("SELECT * FROM `pytox_tingliste` WHERE `kind` LIKE '{$_GET['type']}'") or die(mysql_error());

if (mysql_num_rows($get_the_items) == 0) {

print "ingen";

} else {
?>
<table class="blackborder" style="width:500px;" cellpadding="0" cellspacing="1">
<?php
	while ($item = mysql_fetch_array($get_the_items)) {

if ($o == 0) {
$o = 1;
$bgcolor = "#CCC";
} else if ($o == 1) {
$o = 0;
$bgcolor = "#FFF";
} else {
$o = 1;
$bgcolor = "#CCC";
}

?>
<div style="width:500px;padding:2px;background-color:<?=$bgcolor?>;" class="blackborder">
</div>
<?php
	}
}
}
?>