I have the following function being called multiple times in a
controller:

        function _link_node($lat, $lng, $line_id){
                $result = $this->Node->query('SELECT COUNT(*) FROM nodes');
                var_dump($result);
                $result = $this->Node->find("lat = $lat AND lng = $lng");
                echo "lat = $lat AND lng = $lng ";
                var_dump($result);

                if($result == false){
                        $node['lat'] = $lat;
                        $node['lng'] = $lng;
                        $this->Node->create();
                        $this->Node->save($node);
                }
        }

Basically I only want to create a new node if one doesn't exist with a
given lat and lng. However when I run the script it winds up creating
a whole bunch of nodes with the same lat and lng. I am var_dumping
count of rows on nodes and it remains zero the whole time... but when
I run the script second time, suddenly count or rows goes up to where
it should...

Am I supposed to be flushing the database or something at one point?
Thanks for the help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to