dbconnect(); // for pagination we need cur listings, per page, sorting $listings->perpage = ( isset($_REQUEST['perpage']) && $_REQUEST['perpage'] != '' ? $_REQUEST['perpage'] : 10 ); $listings->curpage = ( isset($_REQUEST['curpage'] ) && $_REQUEST['curpage'] != '' ? $_REQUEST['curpage'] : 1 ); $listings->sortorder = ( isset( $_REQUEST['sortorder'] ) && $_REQUEST['sortorder'] != '' ? $_REQUEST['sortorder'] : "ASC" ); $listings->url = "/foreclosed-homes.html"; $listings->s_city = ( isset( $_REQUEST['city'] ) && $_REQUEST['city'] != '' ? $_REQUEST['city'] : "ASC" ); $listings->s_minprice = ( isset( $_REQUEST['minprice'] ) && $_REQUEST['minprice'] != '' ? $_REQUEST['minprice'] : "" ); $listings->s_maxprice = ( isset( $_REQUEST['maxprice'] ) && $_REQUEST['maxprice'] != '' ? $_REQUEST['maxprice'] : "" ); $listings->s_bedrooms = ( isset( $_REQUEST['bedrooms'] ) && $_REQUEST['bedrooms'] != '' ? $_REQUEST['bedrooms'] : "" ); $listings->s_bathrooms = ( isset( $_REQUEST['bathrooms'] ) && $_REQUEST['bathrooms'] != '' ? $_REQUEST['bathrooms'] : "" ); $listings->s_mls = ( isset( $_REQUEST['mls'] ) && $_REQUEST['mls'] != '' ? $_REQUEST['mls'] : "" ); $listings->s_address = ( isset( $_REQUEST['address'] ) && $_REQUEST['address'] != '' ? $_REQUEST['address'] : "" ); $listings->ptitle = "Homes Near ". ucwords(strtolower($_GET['city'])).", Michigan"; // also .htaccess must allow php within .html files to work properly $_cityzip = (isset($_GET['city']) ? $_GET['city'] : ''); $_bedrooms = (isset($_GET['bedrooms']) ? $_GET['bedrooms'] : ''); $_bathrooms = (isset($_GET['bathrooms']) ? $_GET['bathrooms'] : ''); $_minprice = (isset($_GET['minprice']) ? $_GET['minprice'] : ''); $_maxprice = (isset($_GET['maxprice']) ? $_GET['maxprice'] : ''); $_mls = (isset($_GET['mls']) ? $_GET['mls'] : ''); $_address = (isset($_GET['address']) ? $_GET['address'] : ''); $qd = 0; $q = ""; // original query //$q = "select * from listings where "; // new query to limit results to foreclosures $q = "select * from listings where OWNERSHIP = 'B' AND "; if( $_cityzip != '' ){ $q .= "School_District LIKE '%$_cityzip%' "; $qd++; } if( $_minprice != '' ){ // append AND to query if school included if( $qd > 0 ){ $q .= " AND "; } if( $_maxprice != '' ){ $q .= " ( ListPrice BETWEEN '$_minprice' AND '$_maxprice' ) "; $qd++; } else { $q .= " ListPrice > '$_minprice' "; $qd++; } } else { if( $_maxprice != '' ){ $q .= " ListPrice < '$_maxprice' "; $qd++; } } if( $_bedrooms != '' ){ if( $qd > 0 ){ $q .= " AND "; } $q .= "No_Bedrooms = '$_bedrooms' "; $qd++; } if( $_bathrooms != '' ){ if( $qd > 0 ){ $q .= " AND "; } $q .= "Tot_Baths = '$_bathrooms' "; $qd++; } if( $_mls != '' ){ if( $qd > 0 ){ $q .= " AND "; } $q .= "MLSNUMBER = '$_mls' "; $qd++; } if( $_address != '' ){ if( $qd > 0 ){ $q .= " AND "; } $parts = explode(" ",$_address); $q .= " STREETNUMBER LIKE '%$parts[0]%' AND STREETNAME LIKE '%$parts[1]%' "; $qd++; } $limits = " limit " . ( ($listings->curpage - 1) * $listings->perpage ) . ", " . $listings->perpage; $var_ql = mysql_query ("$q AND STATUS != 'OMKT' ORDER BY LISTPRICE DESC "); $var_ql_limit = mysql_query ("$q AND STATUS != 'OMKT' ORDER BY LISTPRICE DESC $limits"); // also .htaccess must allow php within .html files to work properly ?> <?php echo $p_title;?>

Foreclosed Homes Michigan

Not all foreclosed homes are created equal, and we are here to help Michigan families navigate the foreclosure home buying process. Choosing the right home can make all the difference and that starts right here. We have the most extensive foreclosed home listings available and local experts to assist you.

We work hard to find foreclosed homes in your desired area and price range. Our agents at Michigan Homes Foreclosures are experienced in the foreclosure world and make sure the entire process is handled professional. Our local foreclosure team ensures you get the best value on your dream home.

A Michigan Foreclosed Homes agent can help you to with your next real estate transaction. Once you've had a chance to review the listings on our site we invite you to contact us here or call us at your convenience (810) 626-5600. Our Agents are standing by ready to assist you!

Search by City/Twp

Optional Information:

Address

MLS #

Choose Additional Options

to with and
paginate($var_ql); $listings->displayhomes($var_ql_limit); echo "
\n"; $listings->paginate($var_ql); } ?>