Hi all.

I want to execute custom query on one layer using PHP. $mgSessionId and
$parcel_id are passed from another page and they are ok (I checked with
echo). Here's the code:

<?php
                
                include 'constants.php';
                $mgSessionId = $_GET['SESSION'];
                $parcel_id = $_GET['parcel_id'];
                
    try
    {

        MgInitializeWebTier("$../../webconfig.ini");

        $userInfo = new MgUserInformation($mgSessionId);
        $siteConnection = new MgSiteConnection();
        $siteConnection->Open($userInfo);

        $resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
        $featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
        $map = new MgMap();
        $mgMapName = 'map1';
        $map->Open($resourceService, $mgMapName);
                

                $queryOptions = new MgFeatureQueryOptions();
                $queryOptions->SetFilter("parcel_id = $parcel_id");

                $layer2 = $map->GetLayers()->GetItem('parcels');
                $featureReader = $layer2->SelectFeatures($queryOptions);
                

    }

?>

But this returns the following:

Null reference.Null reference. Exception occurred in method MgMap.GetService
at line 93 in file
d:\buildforgeprojects\mapguide_open_source_v2.0\build_23.8\mgdev\common\mapguidecommon\MapLayer/Map.cpp

What is wrong here?
-- 
View this message in context: 
http://www.nabble.com/Null-reference-query-problem%3A-tp18730412p18730412.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to