Any value how done in search results eg real estate site:any bedrooms, how get data with any beds ?

Can you tell me how to get values [eg. $photo=image3, $details=link3] from database table to build an image and a link ?

<img src="../polis-land/images/search/ <?= $photo ?>.jpg" alt="h" width="200" height="132" />
<a href="../polis-land/apartments/akamasvillageargaka.php<?= $details ?>">

below are two blocks of code in MySQL/PHP can you tell me if working ? If localhost can not accepted to my host server what I must insert ?
also you may find all webpage at
http://www.polis-land.com/mysql/sear...21official.php .
start of search_results.php file I insert:
Code:
<?
$area = $_POST['area'];
$type= $_POST['type']; // land , apts/townhouses , villas
$min = $_POST['min'];
$max= $_POST['max'];
$beds= $_POST['beds'];
// --------------------------------------------------------------------------------
include("dbinfo.php");
$linkid = mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM $type WHERE area=$area AND (bedrooms=$beds OR bedrooms='NA') AND price>$min AND price<$max ORDER BY price desc";
$result = @mysql_query($query,$linkid);

$count = @mysql_num_rows($result);
?>


and insert the below code to a table in the search_results.php below above code:

Code:
<?
$count = @mysql_num_rows($result);
// $type
if ($count > 0) {
while ($i < $count) {
$photo = mysql_result($result,$i,"photo");
$id = mysql_result($result,$i,"id");
$name = mysql_result($result,$i,"name");
$priceeuro = mysql_result($result,$i,"priceeuro");
$pricecyp = mysql_result($result,$i,"pricecyp");
$beds = mysql_result($result,$i,"beds");
$location = mysql_result($result,$i,"location");
$area = mysql_result($result,$i,"area");
$details = mysql_result($result,$i,"details");
$description = mysql_result($result,$i,"description");
?>

<!--
$resultHTML .= "<tr>\n";
$resultHTML .= "<td><img src=".htmlentities($row['photo']." width="140" border="1" /></td>\n";
$resultHTML .= "<td>".htmlentities($row['id'])."</td>\n";

$resultHTML .= "<td><a href=".htmlentities($row['details']).">Details</a></td>\n</tr>\n";
-->
<tr><td><table width="750" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="19%"><img src="../polis-land/images/search/ <?= $photo ?>.jpg" alt="h" width="200" height="132" /></td>
<td width="2%"></td>
<td width="69%" valign="top"><p><strong>Reference Number: </strong><?= $id ?><br />
<strong>Name:</strong><?= $name ?><br />
<strong>Area: </strong><?= $area ?><br />
<strong>Location: </strong><?= $location ?><br />
<strong>Property Type: </strong><?= $type?><br />
<strong>Bedrooms: </strong><?= $beds ?><strong><br />
Summary: </strong><br /><?= $description ?></p>
<table width="480" cellpadding="0" cellspacing="0">
<tr>
<td width="61" align="middle"><strong>Price: </strong></td>
<td width="129" align="middle">Euro €<?= $priceeuro ?></td>
<td width="171" align="middle">CYP &pound;<?= $pricecyp ?></td>
<td width="117" align="middle"><div align="right"><a href="../polis-land/apartments/akamasvillageargaka.php<?= $details ?>">More
Details</a></div></td>
</tr>
</table></td>
<td valign="top" align="right" width="10%">&nbsp;</td>
</tr>
<tr>
<td height="2" colspan="4"></td>
</tr>
</table>
</td></tr>
<tr><td><hr size="3" /></td></tr>
<?
++$i;
} # end while
} else { ?>
<table>
<tr>
<td class="p style2">No results found. Please try again! </td>
</tr>
</table>
<?
} # end ifelse
?>