RE: Unusual Array Results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is that inradius function:

    function inradius($zip,$radius)
    {
        global $db;
        $query="SELECT * FROM zipcodes WHERE zipcode='$zip'";
        $db->query($query);

        if($db->affected_rows()<>0) {
            $db->next_record();
            $lat=$db->f("lat");
            $lon=$db->f("lon");
            $query="SELECT zipcode FROM zipcodes WHERE
(POW((69.1*(lon-\"$lon\")*cos($lat/57.3)),\"2\")+POW((69.1*(lat-\"$lat\"
)),\"2\"))<($radius*$radius) ";
            $db->query($query);
            if($db->affected_rows()<>0) {
                while($db->next_record()) {



                    $zipArray[$i]=$db->f("zipcode");
                    $i++;
                }
            }
        }else{
            return "Zip Code not found";
        }
     return $zipArray;
    } // end func

I have also been trying to re-create my scenarios where the problem
first occurred using $anything[0], but have had no luck, it is either an
intermittent problem or I have not been getting enough sleep -=)

I yanked the code that gets the zips out of my main code and put it in a
file by itself to see how it reacts, same thing, you can see it here:

http://www.pdqval.com/admin/test.php

and the source here

http://www.pdqval.com/admin/test.sphp


Thanks again


-Wendell


-----Original Message-----
From: Andrew Kreps [mailto:andrew.kreps@xxxxxxxxx] 
Sent: Tuesday, October 05, 2004 5:09 PM
To: php-db@xxxxxxxxxxxxx
Subject: Re:  Unusual Array Results

On Tue, 5 Oct 2004 16:50:04 -0700, Wendell Frohwein
<wendell@xxxxxxxxxxxx> wrote:
> Hi Andrew. I'm using a class that was designed to search zip code
> radius's. Here is the piece that gets them.
> 
> 2 Mile Radius Search From 90606
> $radius="2";
> 
> $zipArray1 = $zipLoc->inradius("90606",$radius1);
> $zip_results1=count($zipArray1);
> 
> print_r($zipArray1);

Have you tried a print_r directly on the $zipLoc->inradius call?  Is
it a PHP library, and if so, can you look at what inradius is doing to
build that array?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux