[FX.php List] Results of FMNew()

andy at fmpug.com andy at fmpug.com
Sat Dec 10 12:23:37 MST 2005


Chuck -

You are very welcome.

Just remember, whenever you interact with data in FileMaker using FX.php, the information is returned in a large array. To get the information out of the array, you need to specifiy the correct part of the array. In the case of data inside the fields, you need to look to the [data] portion of the array.

A good way to understand the array returned by FX.PHP is to use

print_r($xResult); (yours would be print_r($newResult); )

This will look like a mess when viewing in the browser. But then go look at the source code and you will see the full array very neatly laid out.

You can also use Lance Hallberg's FXParser which is now included with the latest version of FX.php available from http://www.iviking.org

This is a great utility if you are having issues with a FileMaker query or want to understand the array better.

Enjoy

Andy Gaunt
andy at fmpug.com
http://www.fmpug.com

>
>Andy,
>
>Thanks, that worked perfectly. It's interesting trying to learn both  
>PHP and FX.php at the same time. :)
>
>Chuck
>
>On Dec 10, 2005, at 11:00 AM, andy at fmpug.com wrote:
>
>> Chuck -
>>
>> Try adding a foreach statement after your FMNew to get the data out  
>> of the array
>>
>> foreach ($newResult['data'] as $key => $value)
>> $newID = $value['LoginID'][0];
>>
>> <p>ID: <?php echo $newID; ?></p>
>>
>> Hope this helps
>>
>> Andy Gaunt
>> andy at fmpug.com
>> http://www.fmpug.com
>>
>>>
>>> Here is a code snippet from a page that creates a new record:
>>>
>>>   $newRecord = NewFX('WebLogins');
>>>   $newRecord->AddDBParam('EmailAddress', $EmailAddress);
>>>   $newRecord->AddDBParam('Password', $Password);
>>>   $newResult = $newRecord->FMNew();
>>>   $newEmailAddress = $newResult['EmailAddress'][0];
>>>   $newPassword = $newResult['Password'][0];
>>>   $newID = $newResult['LoginID'][0];
>>>
>>> When this page loads, FileMaker does contain the new record.
>>> Shouldn't $newResult contain the data for that record? LoginID is the
>>> auto-enter serial number key field for the table, and I want to
>>> capture this for later use. But I have a line later in my file:
>>>
>>>     <p>ID: <?php echo $newID; ?></p>
>>>
>>> No information is shown after the "ID:". It's simply blank. What am I
>>> doing wrong?
>>>
>>> Thanks,
>>> Chuck
>>>
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>Chuck Ross
>Author - The Book of AppleScript Studio
>Contributor/Technical Editor - The Book of FileMaker
>Contributing Editor - About This Particular Macintosh
>Contributing Writer - ISO FileMaker Magazine
>mailto:chivalry at mac.com
>AIM:mer0dyn
>web:http://homepage.mac.com/chivalry/
>
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list


More information about the FX.php_List mailing list