* Requirements: * 1. Working FileMaker Server installation * 2. 'FMPHP_Sample' database hosted in FileMaker Server * */ // Include FileMaker API require_once 'FileMaker.php'; // Create a new connection to FMPHP_Sample database. // Location of FileMaker Server is assumed to be on the same machine, // thus we assume hostspec is api default of 'http://localhost' as specified // in filemaker-api.php. // If FMSA web server is on another machine, specify 'hostspec' as follows: // $fm = new FileMaker('FMPHP_Sample', 'http://10.0.0.1'); $fm = new FileMaker('CAROSEL_online_13001'); // Create FileMaker_Command_Find on layout to search $findCommand =& $fm->newFindAllCommand('CAROSEL_online_13001'); // Sort records in descending 'Title' order $findCommand->addSortRule('Title', 1, FILEMAKER_SORT_ASCEND); // Execute find command $result = $findCommand->execute(); if (FileMaker::isError($result)) { echo "Error: " . $result->getMessage() . "\n"; exit; } // Get array of found records $records = $result->getRecords(); // Print out found records // Setup row count variable to alternate row background color $row = 0; foreach ($records as $record) { // if $row is odd, set class of <tr> to alt-row-color
// configure a connection to FileMaker Server Advanced $contactsListConnection = new FileMaker('Contacts.fp7', $serverIP . ':' . $webCompanionPort, $webUN, $webPW); // set database and layout information $contactsListQuery = $contactsListConnection->newFindCommand('web_list'); // add find parameters foreach ($searchRecordsArray as $fieldName => $fieldValue) { $contactsListQuery->addFindCriterion($fieldName, $fieldValue); } // retrieve the records in this database matching the specified parameters available to the current user $contactsObject = $contactsListQuery->execute(); } else { // otherwise, find all records // configure a connection to FileMaker Server Advanced $contactsListConnection = new FileMaker('Contacts.fp7', $serverIP . ':' . $webCompanionPort, $webUN, $webPW); // create a new findall query $contactsListQuery = $contactsListConnection->newFindAllCommand('web_list'); // perform query $contactsObject = $contactsListQuery->execute(); } $fuzzyData = new FX_Fuzzy_Debugger($contactsListConnection, $contactsObject); ?> <html> <head> <title>FX Error Tester</title> </head> <body> <h1>Contact List</h1> <table border="1"> <tr> <th>First Name</th> <th>Last Name</th>
* Requirements: * 1. Working FileMaker Server installation * 2. 'FMPHP_Sample' database hosted in FileMaker Server * */ // Include FileMaker API require_once 'FileMaker.php'; // Create a new connection to FMPHP_Sample database. // Location of FileMaker Server is assumed to be on the same machine, // thus we assume hostspec is api default of 'http://localhost' as specified // in filemaker-api.php. // If FMSA web server is on another machine, specify 'hostspec' as follows: // $fm = new FileMaker('FMPHP_Sample', 'http://10.0.0.1'); $fm = new FileMaker('FMPHP_Sample'); // Create FileMaker_Command_Find on layout to search $findCommand =& $fm->newFindAllCommand('Form View'); // Sort records in descending 'Title' order $findCommand->addSortRule('Title', 1, FILEMAKER_SORT_ASCEND); // Execute find command $result = $findCommand->execute(); if (FileMaker::isError($result)) { echo "Error: " . $result->getMessage() . "\n"; exit; } // Get array of found records $records = $result->getRecords(); // Print out found records // Setup row count variable to alternate row background color $row = 0; foreach ($records as $record) { // if $row is odd, set class of <tr> to alt-row-color
/** * @covers \airmoi\FileMaker\FileMaker::newFindAllCommand * @SuppressWarnings(PHPMD.Superglobals) */ public function testNewFindAllCommand() { $command = $this->fm->newFindAllCommand('sample'); if (!$GLOBALS['OFFICIAL_API']) { $this->assertInstanceOf(Command\FindAll::class, $command); } else { $this->assertInstanceOf(\FileMaker_Command_FindAll::class, $command); } $result = $command->execute(); if (!$GLOBALS['OFFICIAL_API']) { $this->assertInstanceOf(Object\Result::class, $result); } else { $this->assertInstanceOf(\FileMaker_Result::class, $result); } $this->assertEquals(50, $result->getFoundSetCount()); }