This topic is locked
[SOLVED]

Error on a new IIS Server

2/14/2026 21:25:25
PHPRunner General questions
C
chandoshi authorDevClub member

I will appriciate if someone can get back to me with ideas on fixing the below problem.
I have an error that is happening on new 2025 Windows server I am migrating to. It work with no issue on current 2016 Windows Server as well as on my personal web server.

Below code is in an "After Table Initialized" function used to create TABS. The error code is listed at the bottom.

$rs = DB::Query("select GrpId from SP_BusinessUnit where Active = 1 GROUP BY GrpId");
$tabName = "";
$whereStr="";
while( $data = $rs->fetchAssoc() )
{
//WhereTabs::addTab($table, $where, $title, $id)
$whereStr = "GrpId='".$data[GrpId]."'";
$tabName = $data[GrpId];
WhereTabs::addTab(SP_UpcomingServ,$whereStr,$tabName,$data[GrpId]);
}

Fatal error: Uncaught Error: Undefined constant "GrpId" in C:\inetpub\wwwroot\PRSMovers\include\sp_upcomingserv_settings.php:4709 Stack trace: #0 C:\inetpub\wwwroot\PRSMovers\include\phpfunctions.php(3634): include_once() #1 C:\inetpub\wwwroot\PRSMovers\classes\projectsettings.php(156): importTableSettings('SP_UpcomingServ') #2 C:\inetpub\wwwroot\PRSMovers\classes\projectsettings.php(54): ProjectSettings->setTable('SP_UpcomingServ') #3 C:\inetpub\wwwroot\PRSMovers\classes\security.php(1149): ProjectSettings->__construct('SP_UpcomingServ', '', 'listDB') #4 C:\inetpub\wwwroot\PRSMovers\include\commonfunctions.php(8396): Security::userCanSeePage('SP_UpcomingServ', 'listDB') #5 C:\inetpub\wwwroot\PRSMovers\include\menuitem.php(285): menuLinkAvailable('SP_UpcomingServ', 'list', 'listDB') #6 C:\inetpub\wwwroot\PRSMovers\include\menuitem.php(326): MenuItem->linkAvailable() #7 C:\inetpub\wwwroot\PRSMovers\include\menuitem.php(383): MenuItem->showAsLink() #8 C:\inetpub\wwwroot\PRSMovers\include\menuitem.php(399): MenuItem->getMenuXtData('62', 'h', 3) #9 C:\inetpub\wwwroot\PRSMovers\include\menuitem.php(399): MenuItem->getMenuXtData('62', 'h', 2) #10 C:\inetpub\wwwroot\PRSMovers\classes\runnerpage.php(7223): MenuItem->getMenuXtData('62', 'h') #11 C:\inetpub\wwwroot\PRSMovers\classes\runnerpage.php(7204): RunnerPage->assignMenu('main', true) #12 C:\inetpub\wwwroot\PRSMovers\classes\runnerpage.php(1286): RunnerPage->assignMenus() #13 C:\inetpub\wwwroot\PRSMovers\classes\dashboardpage.php(12): RunnerPage->construct(Array) #14 C:\inetpub\wwwroot\PRSMovers\db_schedular_dashboard.php(30): DashboardPage->construct(Array) #15 {main} thrown in C:\inetpub\wwwroot\PRSMovers\include\sp_upcomingserv_settings.php on line 4709

ChatGPT 2/14/2026

The error message you are encountering indicates that the constant GrpId is undefined in the context of the code. This typically means that PHP is interpreting GrpId as a constant rather than an array key. In PHP, if you want to access an associative array's value using a string key, you need to enclose the key in quotes.

In your code, you have:

$whereStr = "GrpId='".$data[GrpId]."'";
$tabName = $data[GrpId];

To fix the issue, you should change GrpId to 'GrpId' (with quotes) so that PHP understands you are trying to access an array key. The corrected lines should look as follows:

$whereStr = "GrpId='" . $data['GrpId'] . "'";
$tabName = $data['GrpId'];

Here’s the full corrected code block:

$rs = DB::Query("select GrpId from SP_BusinessUnit where Active = 1 GROUP BY GrpId");
$tabName = "";
$whereStr = "";
while ($data = $rs->fetchAssoc()) {
//WhereTabs::addTab($table, $where, $title, $id)
$whereStr = "GrpId='" . $data['GrpId'] . "'";
$tabName = $data['GrpId'];
WhereTabs::addTab(SP_UpcomingServ, $whereStr, $tabName, $data['GrpId']);
}

Make sure to replace all occurrences of GrpId in your code where you're accessing it as an array key with quotes to avoid this type of error.

After making these changes, try running your application again on the new Windows Server 2025 and see if the error persists. If you encounter any other issues or errors, feel free to ask for further assistance!

C
chandoshi authorDevClub member 2/14/2026

Solution provided by Chat GP worked