[fx.php_list] Re: Error after upgrading to FX_6.9 (Notice: Undefined index:)

  • From: admin <lars.arler@xxxxxxxxxxxxxx>
  • To: fx.php_list@xxxxxxxxxxxxx
  • Date: Wed, 8 Feb 2017 16:07:37 +0100

Thanks a lot - worked like a charm - and so so simple.

Stupid me, I looked all the wrong places.

And yes you are right on, all the variables are comming from a page with 
multible search forms, so som will allways be empty.

Thanks again


On 8 Feb 2017, at 15.53, Chris Hansen <chris@xxxxxxxxxxx> wrote:

Hey Lars,

Those errors indicate that the parameters listed aren't coming in as part of 
that request. Were they empty perhaps when you did the search? As for 
avoiding those notices, you could simply add code like the following before 
each one (adjusting for each parameter's name, of course):

if (isset($requestArray['profile_1']))

This code could go right on the same line as the corresponding ADDDBParam() 
call.

HTH

--Chris

On 2/8/17 4:28 AM, admin wrote:
System setup
Local test server Apache/2.4.23 (Unix) PHP/5.6.28
Remote Filemaker server 12.0.6.600
FX_6.9

Hi and thanks in advance

I have a strange issue after I have upgraded FX to 6.9, and I can’t figure 
out whats wrong.
Hope some of you guys with kean eyes can lead me to a fix og direct me, so I 
learn what’s wrong. 

The funny part is that the code still works flawless, and do what is 
expected …
But I get this error

Notice: Undefined index: profile_1  on line 51
Notice: Undefined index: profile_2  on line 52
Notice: Undefined index: profile_3  on line 53
Notice: Undefined index: nametype  on line 54
Notice: Undefined index: postnr in  on line 55

I have highlighted those error lines with bold.

So how do I define those index or do I need to rewright the code ??

<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php 
   
include_once('FX_6.9/FX.php');
include_once('FX_6.9/server_data.php');


$requestArrayName = '_' . $_SERVER['REQUEST_METHOD'];
$requestArray = ${$requestArrayName};



$search=new FX($serverIP,$webCompanionPort,$dataSourceType);

// I limit my search returns to 20.... 

 if(isset($_REQUEST['skip'])){ 
$skipSize=$_REQUEST['skip'];
}else{
$skipSize='0';} 
$groupSize='20';

if (isset($_REQUEST['page']) && is_numeric($_REQUEST['page'])) {
    $skipSize = $groupSize * ($_REQUEST['page'] -1);
}
// Implementing search parameters

$search->SetDBData('Glad_BackOffice.fmp12','WebAddress', $groupSize);
if (isset($_REQUEST['skip']) && $_REQUEST['skip'] > 0) {
     $search->FMSkipRecords($_REQUEST['skip']);
      }
      
$search->SetDBPassword($webPW,$webUN);
$search->AddSortParam('Firm','ascend');


if(isset($requestArray['formtype'])){
     
     if (($requestArray['formtype'] == 'all') or ($requestArray['formtype'] 
== ''))
     {$searchResult=$search->FMFindall(); }

     elseif($requestArray['formtype'] == 'select'){
     $search->AddDBParam('status',$requestArray['profile']);
     $search->AddDBParam('Branch',$requestArray['profile_1']);
     $search->AddDBParam('Catagory',$requestArray['profile_2']);
     $search->AddDBParam('sub_Catagory',$requestArray['profile_3']);
     $search->AddDBParam('Firm', $requestArray['nametype'],'cn');
     $search->AddDBParam('postal',$requestArray['postnr'],'cn');
     $searchResult=$search->FMFind();}
}
?>


Other related posts: