dbase-php Random corruption

Chad Streck chads at adci.com
Fri Mar 9 14:32:25 EST 2001


I am now starting to work with queries, but it seems that for the 
attribute data from the dbf, I'm getting random information.  I can 
click on the same object in my map, and get completely different results 
from the dbf, while the shape object has the same information.  So I 
know that the click and the query are working, but not the dbf.

Any help would be appreciated.

tia,
chad

Sample Code:
===========
for($loop = 0; $loop < $query->numresults; $loop++) {
       $shape = $query->next();
        // open db if not opened
       if(($db == 0) || ($oldlayer != $shape->layer)) {
               @dbase_close($db);
               $layer = $mapobj->getlayer($shape->layer);
                //print "$mapobj->shapepath/$layer->data.dbf";
               $db = 
dbase_open($mapobj->shapepath."/".$layer->data.".dbf", 0);
       }
        $index = $shape->shape + 1;
       // PHP dies when I try to execute dbase_get_record_with_names
       // $rec = dbase_get_record_with_names($db, $shape->shape + 1);
       $rec = dbase_get_record($db, $shape->shape + 1);
        foreach($rec as $value) {
               print "<br>$value";
       }
        $oldlayer = $shape->layer;
}
@dbase_close($db);

Map Layer Definition:
=================
   class
     color 225 225 225
     name "Counties"
     outlinecolor 150 150 150
     label
       antialias
       buffer 3
       color 255 32 255
       font "helv"
       mindistance 100
       minfeaturesize 90
       position cc
       size 10
       type TRUETYPE
     end
   end
   queryitem "polygon_nm"
   tolerance 0
   query
     expression /./
     template ""
   end
  end

System:
======
Linux Mandrake 7.2
PHP 4.04pl1 - ./configure --with-apxs=/usr/sbin/apxs --without-mysql 
--with-system-regex --with-dbase
Mapserver 3.4 - ./configure --with-apxs=/usr/sbin/apxs 
--with-php=../../php-4.0.4pl1 --with-freetype --with-proj





More information about the mapserver-users mailing list