[FX.php List] Results of FMNew()

Charles Ross chivalry at mac.com
Sat Dec 10 14:17:43 MST 2005


Andy,

I had heard of FXParser, but hadn't checked it out yet. I'll do so  
today. I'm beginning to understand what I'm working with here.

Another problem I'm having it working with the optional third  
parameter to AddDBParam.

Rather than describe what I'm doing, which is certainly wrong, I'll  
describe what I want to accomplish. Given two fields in a form, I  
want the user to fill both in and click a "submit" button that finds  
the record that exactly matches the text input. A single record  
exists, the EmailAddress field has "chivalry at mac.com" and the  
Password field has "1234". If the user searches for exactly both of  
those, that single record is found. If the user uses a substring for  
either one or leaves either one blank, no record is found, so  
searching "chivalry", "1234" returns no record, "chivalry at mac.com",  
"123" returns no record, only "chivalry at mac.com" and "1234" returns  
the single existing record.

Thanks,
Chuck

On Dec 10, 2005, at 11:23 AM, andy at fmpug.com wrote:

> 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
> _______________________________________________
> 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/




More information about the FX.php_List mailing list