Re: Sorting Recordset by a calculation between 2 Records

From: Date: Tue, 18 Mar 2003 18:42:00 +0000
Subject: Re: Sorting Recordset by a calculation between 2 Records
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140160@lists.php.net to get a copy of this message
Vernon wrote:
I am calculating distances between to record's zip codes using php and have a need to sort the recordset by that value. How do I do something like this? I mean it's not a value in the table that I can use the SQL ORDER BY statement. I want to be able to have the distances closest to the individual first.
When you say "using php" I'm assuming that this means you are not doing the calculation at the database, but rather in your PHP code. Use the distance you've calculated as the numeric index of an array, pointing to the record that corresponds to that distance. Erik

« previous php.general (#140160) next »