
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.95 KB | hits: 12 | expires: Never
/*
* Split the string into an array, process each piece separately.
*/
foreach( $stringArray as $string ) {
/*
* Handle street and apartment numbers using a LIKE, normally these will be
* under 4 characters
*/
if( is_numeric($string) ) {
$where .= " AND (
FormattedAddress LIKE '%".$string."'
OR FormattedAddress LIKE '".$string."%'
)\n";
// Most of the time we should match on string > 3, if not, use a like
} elseif( strlen($string) > 3) {
$where .= " AND MATCH(FormattedAddress) AGAINST (".r3a($string).")\n";
}
}
----
$query = "
SELECT
E.FormattedAddress,
E.Address,
E.ESIID,
E.City,
E.Zip
FROM
EnergySavings.ESIIDs E
WHERE
E.Zip = " . r3a($_REQUEST['Zip']) . "
{$where}
ORDER BY
E.FormattedAddress ASC
LIMIT 10