Have Problem on Checking condition before insert to Mysql Table
| From: | Jack | Date: | Thu, 30 May 2002 10:20:35 +0000 |
| Subject: | Have Problem on Checking condition before insert to Mysql Table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19517@lists.php.net to get a copy of this message | ||
Dear all
I had a table which store the user's Leave records.
There ar two field in table that i had picked for the checking Process. 1:
Leave_From, 2:Leave_To.
What i want to check is either Leave_From or Leave_To will not overlap
between the Records in Database. I know it quit hard to understand what i
want to do, so here is an example :
Existing Records in Table:
Name Staff Code Leave_From Leave_To Backup_Staff
JACK 123 2002-01-15 2002-01-17 Someone
User Input:
Name Staff Code Leave_From Leave_To Backup_Staff
May 234 2002-01-16 2002-01-18 Someone
As you look at the Record input by user, you can find out that there is an
overlap Entry on User Input's "Leave_From" field.
It is in between the record in Existing Record's Date.
2002-01-15 -> 2002-01-16 <- 2002-01-17
I want to stop any record like this case insert to my table!
Does anyone know how to Prevent it?
--
Thx a lot!
Jack
nedcor4@nedcor.com.hk