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.

FX PHP Filemaker

Featured Replies

  • Newbies

Hello.

I have just begun working on tying a Filemaker database to the web using PHP and the FX.php tool. I'm very new at all this stuff and am just getting my feet wet, but I have a question that is PHP related. If anyone has used this method to get their database hooked up, I would love some help.

So, here is the situation

Database of photos with keywords

When you search for a keyword, the search result is a 4 x "however many necessary" table. I currently have it working so it just shows the images in one long table row, each image it finds it just adds another <td>img</td> section.

Using a loop, how do i make it just write 4 <td>'s and then close the row and start again?

my code is as follows.

<?php

include ("FX/FX.php");

include ("FX/prefs.php");

$FX = new FX ($FMAddress, $FMPort);

$FX->SetDBData('phdb.fp5', 'Web', 'All');

$FX->AddDBParam('keywords', 'football', 'eq');

$FX-> AddSortParam ('Name', 'Ascend');

$search = $FX-> FMFind();

if ($search['foundCount'] > 0)

{

echo "<table width=100%>";

echo "<tr>";

foreach ($search['data'] as $key => $value)

{

echo "<td><img src="http://$FMAddress:$FMPort/".$value['Image'][0]."" /></td>";

}

echo "</tr>";

echo "</table>";

}

else

{

echo "There Are No Search Results";

}

?>

I'm not sure if I am explaining this well as I'm having a hard time getting my head around it, but if anyone has any ideas I would really appreciate it.

Thanks very much

Noah

Why not CDML?

  • Author
  • Newbies

how do you specify to only print 4 <td>s before either starting a new row or a new table?

i basically want a grid of images 4 wide by however long it has to be by the number of results, so 20 results would be 4 wide by 5 tall

i don't mind using cdml, but i couldn't figure out how to specify 4

Try this:

if ($search['foundCount'] > 0) 

{

echo "<table width=100%>"; 

echo "<tr>";

$i = 0; 

foreach ($search['data'] as $key => $value) 

{

$i += 1;

if ($i == 4)

   {

   echo "</tr><tr>";

   $i = 0;

   };

echo "<td><img src="http://$FMAddress:$FMPort/".$value['Image'][0]."" /></td>"; 

}

echo "</tr>"; 

echo "</table>"; 

}

else 

{

echo "There Are No Search Results"; 

}

Good Luck.

Garry

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.