Location: PHPKode > projects > FreeRealty > FR-3.0-0.rc10/browse.php
<?php
// $Id: browse.php,v 2.15 2008/01/02 15:48:57 pat Exp $
//DON'T MESS WITH THIS CODE!
//session_start();
if (file_exists("common.php")) {
include("common.php");
}
else {
 echo "Unable to find configuration file common.php <br />
 <a href=\"install30.php\">
 Perhaps you need to run install30.php</a> ? <br />";
 return;
}
$link = getdb();
//print the header
print "<!-- HERE BEGINNETH THE HEADER -->\r\n";
include("./templates/user_top.php");
?>

<h3>Browse Listings</h3>
<?php
 //calculates the total number of records
$result = mysql_query("SELECT 
	".$table_prefix."homes.id, 
	".$table_prefix."homes.status, 
	".$table_prefix."statuses.* 
	from	
	".$table_prefix."homes, ".$table_prefix."statuses
	WHERE 
	".$table_prefix."statuses.id = ".$table_prefix."homes.status 
	and ".$table_prefix."statuses.shown != 'n' ",
	$link);
 $num_rows = mysql_num_rows($result);
?>
<font class = "title" ><a href="./propview.php">Show all properties (<?php print "$num_rows"; ?>)</a></font>
<form name=pricesearch action="./propview.php" method="get">
<font class = "title" >Find me the perfect property:</font>
<div class="search"> 
<br />							
Minimum Price:
<input type="text" name="minprice">.00 <br />
Maximum Price:
<input type="text" name="maxprice">.00<br />
City: <select name="citystate[]" size="4" multiple> 
<?php
$result = mysql_query("SELECT 
	".$table_prefix."homes.city,
	".$table_prefix."homes.state,
        ".$table_prefix."homes.status,	
	".$table_prefix."statuses.*,
	 count(*) AS num_town 
	FROM ".$table_prefix."homes, 
	".$table_prefix."statuses
	where
	".$table_prefix."statuses.id = ".$table_prefix."homes.status
	and
	".$table_prefix."statuses.shown !='n'
	GROUP BY city,state ORDER BY state, city;",$link);
 while ($a_row =mysql_fetch_array ($result) )
 {
										  $city = stripslashes($a_row['city']); 
  print "<option value=\"$a_row[city]___$a_row[state]\">$city, $a_row[state] ($a_row[num_town])";
										 }
?>
 </select>
 <br />
Type:	<select name="typechoice[]" size="4" multiple>
<?php
 $result = mysql_query("SELECT 
	 ".$table_prefix."homes.status, 
	 ".$table_prefix."type, 
	 ".$table_prefix."property_types.property_type,
	 ".$table_prefix."statuses.shown,  
	 ".$table_prefix."statuses.id, 
	 count(*) AS num_type 
	 FROM ".$table_prefix."homes, 
	 ".$table_prefix."statuses,
	 ".$table_prefix."property_types
	 WHERE 
	 ".$table_prefix."homes.status = 
	 ".$table_prefix."statuses.id and 
	 ".$table_prefix."property_types.id = type
	 and 
	 shown != 'n' GROUP BY ".$table_prefix."type;",$link);

 while ($a_row = mysql_fetch_array ($result) )
{
 print "<option  value=\"$a_row[type]\">$a_row[property_type] ($a_row[num_type])";
}
?>
</select> 
<br />
Status: <select name="statuschoice[]" size="4" multiple>
<?php
$result = mysql_query("SELECT 
	".$table_prefix."statuses.status as show_status, 
	".$table_prefix."homes.status as id_status, 
	count(*) AS num_town 
	FROM 
	".$table_prefix."homes,
	".$table_prefix."statuses
	where
	".$table_prefix."statuses.id = 
	".$table_prefix."homes.status and
	".$table_prefix."statuses.shown != 'n'  
	GROUP BY 
	".$table_prefix."homes.status;",$link);
									while ($a_row = mysql_fetch_array ($result) )
										{
	print "<option  value=\"$a_row[id_status]\">$a_row[show_status] ($a_row[num_town])";
										}
?>
									</select>
<br />
Properties will have at least one of the following features when checked. 
<br /><input type="checkbox" name="exact"> Match <b>all</b> features when checked
							
 <div class="features">
  <div class="leftfeatures">HOME FEATURES</div> 
  <div class="rightfeatures">COMMUNITY FEATURES </div>
  <div class="leftfeatures">
	





<?php
show_features(true, null, true, $table_prefix);
?>
						</div></div>
					<br />	
							<input type=submit value="Find my perfect home"></div></form>
				
<?php
//print the footer
		print"\r\n<!-- THUS ENDETH THE MAIN CONTENT -->\r\n<!-- HERE BEGINNETH THE FOOTER -->";
		include("$install_path/templates/user_bottom.php");

//gots to close the mysql connection
?>
Return current item: FreeRealty