Re: Array craziness - Someone plese help
| From: | Vernon | Date: | Sun, 06 Apr 2003 19:08:31 +0000 |
| Subject: | Re: Array craziness - Someone plese help | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142607@lists.php.net to get a copy of this message | ||
A user will log in and there zip code is set in a session. I then take that
zip code and compare it against another zip code in the database. As I loop
through the database each record is compared to the user's zip and a
function is run giving me the distance of the user. What I want to do is
sort the database by that value, but that value doesn't exist in the
database it is created by the script itself so I cannot use SQL to sort the
database. It was suggested that I put the database in an array, add the new
value created by the script, and sort it by this new value. I thought that I
could use the array_push, but still how to I add that to a recordset where
the value I need to sort it by is created on the fly?
Does that make it clearer?
V
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:001001c2fc6d$7e8bef50$7c02a8c0@coconut...
> I don't understand what you want the result to be. Can you give an
> example? Do you just want to keep track of all the $totaldist results?
> If so:
>
> $totaldist[] = distance($line1[0],$line1[1],$line2[0],$line2[1],"mi");
>
> ---John W. Holmes...