This topic is locked

Resolving time Conflict

3/3/2006 11:13:52 AM
PHPRunner General questions
B
Bebel author

Hello fellow blessed people of the phpRunner world,

I have a quick question and hopefully any of you would lend a hand to help:
I am building a very small and simple class registration application for student. The main feature I want to have implemented is to have students view the list of classes and click on those they are interested in and register in them (just like a shopping cart). That, I can do. I need help in resolving schedule conflicts though.
I have assigned a time_code to each class that indicate it's time, day and session. Therefore, if a student select any 2 classes that have the same time_code, the system warns him that there is time conflict and he has to select another class.
My question is, how can I use phprunner to manage the time conflict situation using the "time_code" I have have assigned.
Thank you
A newbie in the block

B
Bebel author 3/3/2006

Hello fellow blessed people of the phpRunner world,

I have a quick question and hopefully any of you would lend a hand to help:
I am building a very small and simple class registration application for student. The main feature I want to have implemented is to have students view the list of classes and click on those they are interested in and register in them (just like a shopping cart). That, I can do. I need help in resolving schedule conflicts though.
I have assigned a time_code to each class that indicate it's time, day and session. Therefore, if a student select any 2 classes that have the same time_code, the system warns him that there is time conflict and he has to select another class.
My question is, how can I use phprunner to manage the time conflict situation using the "time_code" I have have assigned.
Thank you
A newbie in the block


Nobody to help a desperate brother out? I tried to get that done today, I am still stuck though!
Thanks for any consideration

Sergey Kornilov admin 3/6/2006

Bebel,
you can do it using events. Select check if specific record exists in Before record added event on the Events Tab. Please see my example:

function BeforeAdd(&$values)

{

global $conn;

$strSQLExists = "select * from AnyTable where time_code=".$values["time_code"];

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

// if record exists do something

echo "Warning!!"

}

else

{

// if dont exist do something else

}

return true;

}



where AnyPage is exact table name.