[FX.php List] Looping validation

Josh Shrier joshshrier at gmail.com
Sun Sep 7 16:20:53 MDT 2008


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



More information about the FX.php_List mailing list