<?php
function minimize($img_src, $percentage) {
$percentage /= 100;
$width = imagesx($img_src);
$height = imagesy($img_src);
$new_width = $width * $percentage;
$new_height = $height * $percentage;
return '<img src="'. $img_src .'" style="height: '. $new_height .'; width: '. $new_width .';" />';
}
?>
<style type="text/css">
<!--
body {
background-color: #00CCCC;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 12px;
}
.style2 {
font-size: x-large;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style>
<p class="style2">De Franse Makelaar</p>
<p class="style1">Gevonden resultaten die voldoen aan uw zoekcriteria: </p>
<p>
<?php
if ( isset( $_POST['Plaats'], $_POST['Soort'], $_POST['Prijs'] ) ) {
$Plaats = $_POST['Plaats'];
$Soort = $_POST['Soort'];
$Prijs = $_POST['Prijs'];
$host = "localhost"; // afhankelijk van de host
$username = "root"; // ook, afhankelijk van de db
$password = ""; // idem
$db = "makelaar";
$dbh = mysql_pconnect ( $host, $username, $password );
if ( $dbh ) {
mysql_select_db($db);
}
$query = "SELECT * FROM makelaar_tabel WHERE prijs = '$Prijs' AND streek = '$Plaats' AND soort = '$Soort'" ;
$res = mysql_query ( $query );
if(mysql_num_rows($res) > 0)
?>
<!-- eerst de kolomkoppen voor de tabel in plain HTML schrijven -->
<table border="1" width="93%" align="center">
<tr>
<td colspan="5"><h2 align="center" class="style1">Gevonden resultaten </h2></td>
</tr>
<tr>
<th width="5%"><span class="style3">Foto</span></th>
<th width="5%"><span class="style3">Streek</span></th>
<th width="17%"><span class="style3">Prijsklasse</span></th>
<th width="16%" class="style3">Soort woning</th>
<th width="16%" class="style3">Informatie ligging</th>
<th width="32%" class="style3">Meer informatie</th>
</tr>
<!-- Vanaf hier de PHP while()-lus. Elke lusdoorgang schrijft
een tabelrij naar het scherm -->
<?php
while( $row = mysql_fetch_assoc ( $res ) ) {
$foto = $row['id_woning'];
$woningfoto = minimize("images/". $foto .".jpg", 50);
echo'
<tr>
<td>'. $woningfoto .'</td>
<td>'. $row['streek'] .'</td>
<td>'. $row['prijs'].'</td>
<td>'. $row['soort'] .'</td>
<td>'. $row['ligging'] .'</td>
<td>
<a href="meerinformatie.php?id_woning='. $row['id_woning'] .'">Meer informatie</a>
</td>
</tr>' . "\n";
}
} else {
echo "Er zijn geen resultaten";
}
?>