[FX.php List] Looping validation

Gjermund Gusland Thorsen ggt667 at gmail.com
Mon Sep 8 00:52:19 MDT 2008


There are other design methods than scripts, you can make logic on
validation of fields.

ggt

2008/9/8 Derrick Fogle <derrick at fogles.net>:
> The single biggest performance hit (95% of total execution time) will be
> getting data between FMP and PHP. If this were engineered in PHP with MySQL
> (or similar) as a database, it would blow the doors off anything that
> involved FMP. But FMP scripts are reasonably fast in their native
> environment, so if you can just trigger the script and it works, that will
> be your second best option in terms of performance. By far the worst
> performance will be getting all the data out of FMP, processing it in PHP,
> then inserting data back into FMP from the PHP script.
>
> If you've got a script that's working, I would have to recommend trying to
> just trigger the script. There are some gotchas in there (FMP global fields
> don't really work with the API's), but it's a heck of a lot less work (and
> will be faster) than completely re-engineering the script in PHP.
>
> HTH,
>
> On Sep 7, 2008, at 5:20 PM, Josh Shrier wrote:
>
>> What is the downside to using the script instead of rewriting the script
>> in
>> PHP? Is there a dramatic speed difference? Is it that other users will be
>> slower while that is running and in PHP not?
>>
>> -Josh Shrier
>>
>> -----Original Message-----
>> From: fx.php_list-bounces at mail.iviking.org
>> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Derrick Fogle
>> Sent: Monday, September 08, 2008 12:18 AM
>> To: FX.php Discussion List
>> Subject: Re: [FX.php List] Looping validation
>>
>>>>
>>
>> The PHP scripting would actually be very similar, in concept, to your
>> FMP script. The syntax is just completely different.
>>
>> I'm a little fuzzy on how you get to the point you start at in your
>> description, so I'll start with the "creates variables for date and
>> time" part. The PHP equivalent is a form that submits the date and
>> time to another PHP script. In that 2nd PHP script, use FX.php to find
>> all tutor staff records with (I'm guessing) the portal data of
>> scheduled time.
>>
>> You'll need a couple nested foreach() statements to loop through first
>> the staff records, and within each staff record, loops through the
>> portal data. The comparisons you use in FMP vs PHP to determine
>> availability  will be virtually identical, although you'll probably
>> need to learn a bit about unixtime and PHP's date and time functions
>> to pull it off.
>>
>> When a match is found, create the schedule record in FMP and redirect
>> to a 'successful' page. If you get to the end of the nested loops,
>> you're in error territory and can show the error there.
>>
>> Just remember that the logic used in your FMP script is the exact same
>> logic you'll use in the PHP script. You've just got to learn the PHP
>> syntax, and how to get data in and out of FMP with FX.php, to
>> implement it.
>>
>> Good luck!
>>
>>>> 2008/9/7 Josh Shrier <joshshrier at gmail.com>:
>>>>>
>>>>> I have a script that checks if an activity a user suggests have an
>>>>
>>>> available
>>>>>
>>>>> employee to train at that date and time. The way the script works
>>>>> is it
>>>>> creates variables for the date and time, and then goes to the
>>>>> staff table
>>>>> and loops through the portal rows to see if that person has a spot
>>>>> available. If yes, then it books that trainer. If not, it goes to
>>>>> the next
>>>>> staff member and repeats the same. If the script gets through all
>>>>> the
>>>>
>>>> staff
>>>>>
>>>>> members and there is no one available during that time then an
>>>>> error is
>>>>> returned. I would like to know how to approach coding this script
>>>>> in PHP,
>>>>> given that the staff table is not related to the contacts table
>>>>> until a
>>>>> staff member is chosen which isn't until the end of the script.
>>
>>
>> Derrick
>>
>> _______________________________________________
>> 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
>
>
> Derrick
>
> _______________________________________________
> 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