BBC reports that Google updates its search engine for faster results.
Posts Tagged ‘search engine’
Google Updates Search Engine for Faster Results
Saturday, November 5th, 2011Zipcode Proximity Search
Friday, May 6th, 2011The following PHP function is to search for zipcodes within X miles away from the zipcode searched.
function getZipCodes($search, $miles_away) { ini_set('memory_limit', '256M'); // set 128 MB memory limit $lines = file($_SERVER["DOCUMENT_ROOT"].'/demos/zipcode-proximity-search/zipcodes.csv'); foreach($lines AS $line) { $parts = explode("\",\"", $line); $zipcode = str_replace('"', "", $parts[0]); $latitude = $parts[1]; $longitude = $parts[2]; $type = $parts[5]; if($type != "MILITARY") { if($zipcode == $search) { $search_coords = array( 'zipcode' => $zipcode, 'lat' => $latitude, 'long' => $longitude ); } $zipcode_coords[] = array( 'zipcode' => $zipcode, 'lat' => $latitude, 'long' => $longitude ); } } foreach($zipcode_coords AS $coords) { if(calc_distance($coords, $search_coords) < $miles_away) { $return[] = $coords['zipcode']; } } return $return; } function calc_distance($point1, $point2) { $radius = 3958; // Earth's radius (miles) $pi = 3.1415926; $deg_per_rad = 57.29578; // Number of degrees/radian (for conversion) $distance = ($radius * $pi * sqrt( ($point1['lat'] - $point2['lat']) * ($point1['lat'] - $point2['lat']) + cos($point1['lat'] / $deg_per_rad) // Convert these to * cos($point2['lat'] / $deg_per_rad) // radians for cos() * ($point1['long'] - $point2['long']) * ($point1['long'] - $point2['long']) ) / 180); return $distance; // Returned using the units used for $radius. }
You would then call the function by using:
$zipcodes = getZipCodes($_POST['search'], "5.01");
You could then use this function to create your SQL query:
$sql = "SELECT id, zipcode FROM directory"; $total_query = mysql_query($sql) or die(mysql_error()); $total_numrows = mysql_num_rows($total_query); if($_POST['doSearch'] && $searchby == "zipcode") { $zipcodes = getZipCodes($_POST['search'], "5.01"); $i = "0"; foreach($zipcodes AS $zipcode) { if($i == "0") $sql .= " WHERE "; else $sql .= " OR "; $sql .= "zipcode = '" . $zipcode . "'"; $i++; } } elseif($_POST['doSearch']) { $sql .= " WHERE " . $searchby . " LIKE '%" . $_POST['search'] . "%'"; }
You may download the CSV file of all zip codes here. If this post was helpful please leave a comment to let us know!
9 Ways To Improve the SEO of Every Website You Design
Saturday, April 17th, 2010Six Revisions write on 9 Ways To Improve the SEO of Every Website You Design
Content Placement and Keyword Density
Tuesday, February 16th, 2010Content Placement
The order in which you place your content is important. Since search engine web crawlers only index up to a certain amount of data for a given page, unique content should come first to ensure it gets indexed. This has the added benefit of placing your page’s unique content first in the hierarchy of your page’s content.
Keyword Density
You also want to be sure to use your targeted keywords (the ones specified in that page’s META tags) in your unique content wherever possible, within reason. Don’t lose focus on providing readable content just to get more instances of your keywords in there.


