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 - Cannot use a scalar value as an array???

Featured Replies

I am new to FX.php and I have only worked with php (never created any) and I can't seem to get FX.php to communicate with our FMServer Advance. Instead, I get a weird error that points to a line of code on my test php page. Here is the scenario:

I am trying to test connectivity with fx and our Filemaker server advance machine by doing a simple find all with a test php page. The code I am using looks like this:

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>

<?php

include_once('FX/FX.php');

include_once('FX/FMErrors.php');

include_once('FX/server_data.php');

$groupSize='50';

$findall=new FX($serverIP,$webCompanionPort,'FMPro7');

$findall->SetDBData('web.fp7','web',$groupSize);

$findall->SetDBPassword('password','fmsadmin');

$findallResult=$findall->FMFindall();

echo $findallResult['errorCode'];

foreach($findallResult['data'] as $key=>$findallData);

?>

<html>

<head>

</head>

<body>

<br></body>

</html>

</body>

</html>

When I access this page from my web browser I get the following error:

Warning: Cannot use a scalar value as an array in /Library/WebServer/Documents/test1.php on line 27

Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/test1.php on line 27

Does anyone have a clue as to what this means?:

I have installed the FX software on two OS X machines - one running 10.4 and Apache 1.3.33 another the other running 10.2.8 with Apache 1.3.29 - neither one of the machines are able to do the simple find query to our FileMaker Server (Version 7.0.3). I have followed the FX instructions to the letter, in fact, I have even reinstalled FileMaker server (per FX tech supports recommendation) and the queries still do not work. The error is the same on both computer configurations.

Any help is greatly appreciated!!!

-Van

What happens if you replace the line:

foreach($findallResult['data'] as $key=>$findallData);

with:

print_r($findallResult['data']);

I would place the top part of the html (i.e. from <html> to <body>) before the php. So that you can use echo and print_r within the body of the page.

Good Luck.

Garry

  • Author

I tried the code you suggested, but im not sure what you mean by:

"I would place the top part of the html (i.e. from <html> to <body>) before the php. So that you can use echo and print_r within the body of the page."

There are several <html> to <body> tags and I not sure where or what I should move around. When I run the page as is, I don't get the scalar error anymore, I just get a blank page. I would like to see some type of output to ensure I have a good connection to my FMServer.

Thanks for the help.

-Van

  • 6 months later...
  • Newbies

I had a similar problem when I initially set up FX.php. At the time I was running PHP 4.x.x (can't remember which exactly) and when I updated to PHP 5.0.4 it resolved the problem and I no longer get that error message.

Hope that helps.

Cheers, Chris

)

2. Delete lines 41 and 42 (

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.