[FX.php List] FX issue moving FMServer 11 to FMServer 12
Dale Bengston
dale.bengston at gmail.com
Mon Mar 2 10:13:02 MST 2015
Hi Sam,
This is a classic. When FX returns data results, it’s a PHP array. When it returns an error, it’s a PHP object. Your lines following
> $searchResult=$search->FMFind();
… are expecting an array, but $searchResult is an error object. Put this after your FMFind() call:
print_r($searchResult);
… and you will get a screen dump of the error object, and that should give you more information about what’s failing.
-Dale
> On Mar 1, 2015, at 2:27 PM, SmilePix <sam at smilepix.com> wrote:
>
> Finally bitting the bullet and converting my old fp7 database to fmp12. I have been using fx.php for at least 10 years with my present database and it has worked fine. I am finding a glitch in being able to do the first find which is a result of a client logging into the database.
>
> Here is what worked on FMSever 11 (there is a portal on the page):
>
> <?php
> if(!isset($_REQUEST['dr_id']) || $_REQUEST['dr_id'] == "")
> {
> header("Location: nologin.html");
> exit();
> };
> session_start();
> include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php");
> include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/FX_Error.php");
> include_once($_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php");
>
>
> $dr_id = $_REQUEST['dr_id'];
>
> $groupSize='20';
> $skip = 0;
> if(isset($_GET['skip']))
> { $skip = $_GET['skip']; }
> else
> { $skip = 0;};
>
> $search=new FX($serverIP,$webCompanionPort,'FMPro7');
> $search->SetDBData('SmilePix.fp7','cases_php',$groupSize);
> $search->SetDBPassword(‘...’,’...');
> $search->AddDBParam('dr_id',$dr_id);
> $search->AddSortParam('pat_id','descend');
> $search->FMSkipRecords($skip);
> $searchResult=$search->FMFind();
>
> $searchDataKeys = array_keys($searchResult['data']);
> $searchData = $searchResult['data'][$searchDataKeys[0]];
>
>
> $_SESSION['DrId']=$searchData['dr_id'][0];
> $_SESSION['web_title']=$searchData['web_title'][0];
> $_SESSION['email']=$searchData['email'][0];
>
> $balance = number_format($searchData['balance'][0],2);
>
> ?>
>
> On FMServer 13 I am getting an error at this point:
>
> line 30 $searchDataKeys = array_keys($searchResult['data']);
> line 31 $searchData = $searchResult['data'][$searchDataKeys[0]];
>
> Fatal error: Cannot use object of type FX_Error as array in /home/smilep6/public_html/client3/home.php on line 30
>
> I have searched around, but can not figure out why it works on FM 11 and not FM 13. I have the latest version of fx.php (6.0).
>
> Thanks in advance for your help - Sam
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20150302/770663b1/attachment.html
More information about the FX.php_List
mailing list