<?php
require_once("config_sql.php");
echo '<table border="0" cellpadding="0" cellspacing="0">';
echo "<tr>";
echo "<td colspan='5' height='2'></td>";
echo '</tr>';
$csql = "SELECT * FROM `kamers` WHERE type='openbaar';"; 
$cres = mysql_query($csql); 
if (mysql_num_rows($cres) >= 1) 
{
	while ($row = mysql_fetch_array($cres)) 
    {
	    $result = mysql_query("SELECT * FROM `favorites` WHERE kamerid='".$row['id']."' AND member='".$_GET['jouwnaam']."';");
		if (mysql_num_rows($result) >= 1)
		{
			$favoriet = "ja";
		}
		else
		{
			$favoriet = "nee";
		}
		echo "<tr>";
		echo "<td><img src='images/navi/links.gif'></td>";
		echo "<td onclick=\"kamer('".$row['naam']."', '".$row['omschrijf']."', '".$row['type']."', '".$row['safe']."', '".$row['eigenaar']."', ".$row['id'].", '".$favoriet."', '".$row['pass']."');\" width=\"227\" bgcolor=\"#DADADA\"><div class='clientfont'><img src='images/navi/sloten/".$row['safe'].".gif'>&nbsp;".$row['naam']."</div></td>";
		echo "<td><img src='images/navi/rechts.gif'></td>";
		echo "<td width='2'><font color='black' size='2'>&nbsp;</font></td>";
		echo "<td><a onclick=\"gaklik('".$row['naam']."', '".$row['omschrijf']."', '".$row['type']."', '".$row['safe']."', '".$row['eigenaar']."', ".$row['id'].", '".$favoriet."', '".$row['pass']."');\"><img src='images/navi/ga.gif' border='0' style='cursor: default;'></a></td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan='5' height='2'></td>";
		echo "</tr>";
	}
}
else
{
	echo "<table border='0' cellpadding='0' cellspacing='0'>";
	echo "<tr>";
	echo "<td colspan='2' height='8'></td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td width='8'></td>";
	echo "<td>";
	echo "<div class='clientfont'>";
	echo "Er zijn nog geen openbare ruimten.";
	echo "</div>";
	echo "</td>";
	echo "</tr>";
	echo "</table>";
}
echo "</table>";
?>