4 Replies Latest reply on Apr 13, 2017 5:40 AM by beverly

    PHP API Request Filtering '@' characters?

    azriley

      Title

      PHP API Request Filtering '@' characters?

      Post

           Any idea on where to configure? Using the find command in the API. If a record has an @ symbol the can not get a result. Remove the @ symbol in the record and the result appears. Tested against variety of fields including Address1, Neighborhood, Username, etc.

            

            

           PHP CODE BELOW

                   $filters = array("Password" => "test", "PrimaryCampus" => "Main Campus", "zk_ContactID" => "2023", "PhoneHome" => "724-111-1111", "PrimaryPhone" => "Home",
                       "B_Country" => "USA", "City" => "test", "State" => "PA", "PostalCode" => "15301", "County" => "test", "Country" => "USA",
                       "LabelName" => "Aaron", "Contact_Indiv_HoH1::NameFull" => "Aaron", "zi_PrimaryPhoneReturn_c" => "724-111-1111", "zi_CountIndividuals" => "3",
                       "Address1" => "@some address", "DoNotMail" => "0");

           if(is_array($filters))
                   {
                       // FIND QUERY
                       $findCommand =& $fm->newFindCommand($this_layout_name);

                       //$findCommand->addFindCriterion("ClassYear", "2013");
                       //$findCommand->addFindCriterion("ClassTerm", "Summer");
                                   
                       foreach($filters as $key => $value)
                       {
                           $findCommand->addFindCriterion($key, $value);
                       }
                   }
                   else
                   {
                       // FIND ALL QUERY
                       $findCommand =& $fm->newFindAllCommand($this_layout_name);
                   }

                   // LIMIT RESULTS
                   $findCommand->setRange(0, $max);
                   
                   // SORT PROPERTIES
                   if(isset($sort))
                   {
                       // DIRECTION
                       if(isset($sort_dir))
                       {
                           if($sort_dir == "DESC")
                               $sort_dir = FILEMAKER_SORT_DESCEND;
                           else
                               $sort_dir = FILEMAKER_SORT_ASCEND;
                       }
                       else
                       {
                           $sort_dir = FILEMAKER_SORT_ASCEND;
                       }

                       // SORT QUERY
                       $findCommand->addSortRule($sort, 1, $sort_dir);
                       
                   }


                   $result = $findCommand->execute();


                   // GET ERROR
                   if (FileMaker::isError($result)) {
                       $records = $result->getMessage();
                       //exit;
                   }
                   else {
                       $records = $result->getRecords();
                   }