|
19 | 19 | // Instantiate the class FMDataAPI with database name, user name, password and host. |
20 | 20 | // Although the port number and protocol can be set in parameters of constructor, |
21 | 21 | // these parameters can be omitted with default values. |
22 | | - $fmdb = new FMDataAPI("TestDB", "web", "password", "192.168.17.130" /*"localhost"*/); |
| 22 | + $fmdb = new FMDataAPI("TestDB", "web", "password", "localhost"); |
23 | 23 |
|
24 | 24 | //============================== |
25 | 25 | //$fmdb = new FMDataAPI("TestDB", "web", "password", "localserver"); |
|
59 | 59 | $pInfo = var_export($result, true); |
60 | 60 | echo htmlspecialchars("Layout Metadata (Old): {$pInfo}", ENT_QUOTES, "UTF-8") . "<hr>"; |
61 | 61 |
|
62 | | - exit; |
63 | 62 | // The FMDataAPI has the property as the same name of layout. This sample database has the 'person_layout' layout, |
64 | 63 | // so '$fmdb->person_layout' refers FMLayout object fo the proxy of the layout. FMLayout class has the 'query' method |
65 | 64 | // and returns FileMakerRelation class's object. The condition spefied in parameter is same as FileMaker's Find Record API. |
|
271 | 270 | } |
272 | 271 | } |
273 | 272 |
|
274 | | - // |
| 273 | + // The getFirstRecord method returns FileMakerRelation class object. |
275 | 274 | $result = $fmdb->person_layout->query(); |
276 | 275 | $first = $result->getFirstRecord(); |
277 | | - echo "id field of the first record: {$first->field('id')}"; |
| 276 | + echo "id field of the first record: {$first->field('id')}<br>"; |
| 277 | + $portals = $first->getPortalNames(); |
| 278 | + echo "getPortalNames of the first record: " . var_export($portals, true) . "<br>"; |
278 | 279 | $contacts = $first->Contact; |
279 | | - echo "[PORTAL(contact_to)] id: {$contacts->field("id", "contact_to")}"; |
| 280 | + echo "[PORTAL(contact_to)] id: {$contacts->field("id", "contact_to")}<br>"; |
280 | 281 |
|
281 | 282 | } catch (Exception $e) { |
282 | 283 | echo '<div><h3>例外発生</h3>', htmlspecialchars($e->getMessage(), ENT_QUOTES, "UTF-8"), "<div>"; |
|
0 commit comments