Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi to all.

 

i have a php page that gives me all company names.

 

I what to have all of the branches in a table in the bottom of the page.

 

this is the php code.

 

 

 

thanks dani

 

 

 

<html>
<?php
 
 
// Include FileMaker API
require_once ('FileMaker.php');
     include ("conect.php"); 
 
 
 
 
$record = $fm->getRecordById('web Main', $_GET['recid']);
 
if (FileMaker::isError($record)) {
    echo "<body>Error: " . $record->getMessage(). "</body>";
    exit;
}
?>
<head>
<title><?php echo $record->getField('Company Name'); ?></title>
<!-- declare charset as UTF-8 -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body dir="rtl">
 
<table>
<tr>
  <th id="table-title" colspan="3">a</th></tr>
<tr>
  <th>b</th><td><?php echo $record->getField('Company Name'); ?></td></tr>
<tr>
  <th>c </th><td><?php echo $record->getField('company phone'); ?></td></tr>
<tr>
  <th>d</th><td><?php echo $record->getField('company fax'); ?></td></tr>
<tr>
  <th>e</th><td><?php echo $record->getField('company Mobile'); ?></td></tr>
<tr>
  <th>f</th><td><?php echo $record->getField('company email'); ?></td></tr>
<tr>
  <th>g</th><td><?php echo $record->getField('Status'); ?></td></tr>
<tr>
  <th>h</th><td><?php echo $record->getField('note'); ?></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="editRecord.php?recid=<?php echo $record->getRecordId(); ?>">edit</a></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="deleteRecord.php?recid=<?php echo $record->getRecordId(); ?>">Delete this record</a></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="displayRecords.php">Back to Record List</a></td></tr>
</table>
<?php $relatedSet = $record->getRelatedSet('cliant company');
    
                    //check for an error
                    if (FileMaker::isError($relatedSet)) {
                        echo "<p>Error: " . $relatedSet->getMessage(). "</p>";
                        exit;
                    }
 
echo $relatedSet; 
 
 
 
 
?>
                    
 
</body>
</html>
 

Try

 

<?php $relatedSet = $record->getRelatedSet('cliant company');
    
                    //check for an error
                    if (FileMaker::isError($relatedSet)) {
                        echo "<p>Error: " . $relatedSet->getMessage(). "</p>";
                        exit;
                    }
 
echo $relatedSet; 
 
echo "<table>n"
$records = $relatedSet->getRecords();
foreach($records as $record){
    echo "<tr><td>" . $record->getField('branchname') . '</td><td>' . $record->getField('branchaddr') . '</td></tr>'; // include whatever other fields desired in row
}
echo "</table>n"; 
 
 
?>
                    
 
</body>
</html>
 

 

  • Author

for i reason it is not working.

 

 

<html>
<?php
 
 
// Include FileMaker API
require_once ('FileMaker.php');
     include ("conect.php"); 
 
 
 
 
$record = $fm->getRecordById('web Main', $_GET['recid']);
 
if (FileMaker::isError($record)) {
    echo "<body>Error: " . $record->getMessage(). "</body>";
    exit;
}
?>
<head>
<title><?php echo $record->getField('Company Name'); ?></title>
<!-- declare charset as UTF-8 -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body dir="rtl">
 
<table>
<tr>
  <th id="table-title" colspan="3">a</th></tr>
<tr>
  <th>b</th><td><?php echo $record->getField('Company Name'); ?></td></tr>
<tr>
  <th>c </th><td><?php echo $record->getField('company phone'); ?></td></tr>
<tr>
  <th>d</th><td><?php echo $record->getField('company fax'); ?></td></tr>
<tr>
  <th>e</th><td><?php echo $record->getField('company Mobile'); ?></td></tr>
<tr>
  <th>f</th><td><?php echo $record->getField('company email'); ?></td></tr>
<tr>
  <th>g</th><td><?php echo $record->getField('Status'); ?></td></tr>
<tr>
  <th>h</th><td><?php echo $record->getField('note'); ?></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="editRecord.php?recid=<?php echo $record->getRecordId(); ?>">עריכה</a></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="deleteRecord.php?recid=<?php echo $record->getRecordId(); ?>">Delete this record</a></td></tr>
<tr><td colspan="2" style="text-align: center"><a href="displayRecords.php">Back to Record List</a></td></tr>
</table>kk <table border="1">
<tr><td>fff</td></tr>
<?php 
    
                    //check for an error
                    //if (FileMaker::isError($relatedSet)) {
                       // echo "<p>Error: " . $relatedSet->getMessage(). "</p>";
                       // exit;
                   //}
 
?>  
                    
<?php
$relatedSet = $record->getRelatedSet('cliant company');//  cliant company is a related table
$records = $relatedSet->getRecords();
foreach($records as $record){
    echo "<tr><td>" . $record->getField('company name') . '</td><td>' . $record->getField('company name') . '</td></tr>'; // include whatever other fields desired in row
}?>
</table>
 
 
 
 
 
 
 
?>
                    
 
</body>
</html>

Remember that the PHP API is layout-centric.  Do you have a portal to the related table on your layout? It's a good idea to create layouts specifically for PHP interface, each with just the fields required by the PHP script.

  • Author

Yes I have a layout with the portal in the Layout and it is pecifically for PHP interface

I just tried to do a sample and couldn't get it to work either.  Someone told me long ago that getRelatedSets() was difficult to work with.

 

What I DID get to work is the way I usually do it:  Use a newFindCommand(  {layout native to the related table}) with addFindCriterion the same as your relationship criteria, and pull your records from that found set.  

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.