Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Need help with Sort by distance

Quote Reply
Need help with Sort by distance
This is for my ZipCodeSearch Plugin.

I want to sort the results ASC by distance, but 'distance' is not column in my table.
How can I do the sort?
Code:
my $link_db = $DB->table('Links') || return $GT::SQL::error;
$link_db->select_options ('ORDER BY Add_Date ASC') || return $GT::SQL::error;

my $sth = $link_db->select( GT::SQL::Condition->new(
isValidated => '=' => 'Yes',
ExpiryDate => '>=' => time


) );

my $temp_distance;

while (my $link = $sth->fetchrow_hashref)
{

while (my $link = $sth->fetchrow_hashref)
{
$temp_distance = distance($olat, $olon, $link->{Latitude}, $link->{Longitude}, $unitcode);

if($temp_distance <= $dist)
{
$link_count++;
$link->{distance} = $temp_distance;
$link = Links::SiteHTML::tags('link', $link);
push (@link_results_loop, $link);
}
}
}

Thanks
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Subject Author Views Date
Thread Need help with Sort by distance rgbworld 13628 May 28, 2005, 7:04 AM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13516 May 28, 2005, 8:18 AM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13496 May 28, 2005, 11:57 AM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13502 May 28, 2005, 1:04 PM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13446 May 28, 2005, 4:36 PM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13443 May 29, 2005, 4:28 AM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13416 May 29, 2005, 11:24 AM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13391 May 29, 2005, 2:43 PM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13559 May 29, 2005, 4:38 PM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13421 May 30, 2005, 9:51 PM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13448 May 31, 2005, 12:33 AM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13426 May 31, 2005, 10:33 AM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13403 May 31, 2005, 12:17 PM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13373 May 31, 2005, 7:13 PM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13346 May 31, 2005, 9:28 PM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13425 May 31, 2005, 10:25 PM
Thread Post deleted by rgbworld
rgbworld 13378 May 31, 2005, 11:25 PM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13358 May 31, 2005, 11:32 PM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13361 Jun 1, 2005, 2:11 AM
Thread Re: [rgbworld] Need help with Sort by distance
rgbworld 13331 Jun 2, 2005, 12:38 AM
Thread Re: [rgbworld] Need help with Sort by distance
pugdog 13358 Jun 2, 2005, 10:23 AM
Thread Re: [pugdog] Need help with Sort by distance
rgbworld 13290 Jun 5, 2005, 1:45 AM
Post Re: [rgbworld] Need help with Sort by distance
Alba 13088 Apr 17, 2006, 4:31 AM