// Connect to the database include("db.php"); // Get the search criteria $name = $_POST['nameField']; $collectionId = $_POST['collectionIdField']; $squareFeet = $_POST['squareFeetField']; $bedrooms = $_POST['bedroomsField']; $bathrooms = $_POST['bathroomsField']; $floors = $_POST['floorsField']; $searched = $_POST['searched']; // Get the order by variable $orderBy = $_POST['orderByField']; $previousOrderBy = $_POST['previousOrderByField']; $ascDesc = $_POST['ascDescField']; if($orderBy=="") { $orderBy = "SquareFeet"; $ascDesc = "ASC"; } if($orderBy==$previousOrderBy) { if($ascDesc=="ASC") $ascDesc = "DESC"; else $ascDesc = "ASC"; } else $ascDesc = "ASC"; $hookup = mysql_connect($server,$user,$pass) or die (mysql_error()); $dataconnect = mysql_select_db($db) or die (mysql_error()); // If we searched, then obtain the results if($searched=="y") { $query = "SELECT floorplans.FloorPlanId, floorplans.Name, collections.Name AS CollectionName, floorplans.SquareFeet, floorplans.Bedrooms, floorplans.Bathrooms, floorplans.Floors, floorplans.URL FROM floorplans, collections WHERE floorplans.CollectionId = collections.CollectionId"; if($name!="Any") $query.= " AND floorplans.Name LIKE '%$name%'"; if($collectionId>0) $query.= " AND floorplans.CollectionId = $collectionId"; if($squareFeet>0) { if($squareFeet==4200) $query.= " AND floorplans.SquareFeet >= 4200"; else $query.= " AND (floorplans.SquareFeet > ".($squareFeet - 499)." AND floorplans.SquareFeet < $squareFeet)"; } if($bedrooms>0) $query.= " AND floorplans.Bedrooms >= $bedrooms"; if($bathrooms>0) $query.= " AND floorplans.Bathrooms >= $bathrooms"; if($floors>0) $query.= " AND floorplans.Floors = $floors"; if($orderBy=="CollectionName") $query.= " ORDER BY collections.Name $ascDesc"; else $query.= " ORDER BY floorplans.$orderBy $ascDesc"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); } ?>
![]() |
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Home | About Us | Floorplans | Gallery | Why Precision? | Where We Build | Contact Us |
||||||||||||||||||||||

If you would like to contact Precision Homes or see more of our Precision Homes please contact Precision Homes by calling 281.353.9883.
Precision Homes - Website by Mark Ramos Designs