Compare User input

26 Views Asked by At

I have a set of date (start date & end date) in DB, how to validate for duplicate date set between user input and DB. (Mysql)

i have try a few method but it only compare either start or end date only. not both at the same time.

1

There are 1 best solutions below

0
Carlos J. On

I think you are looking for the following logic.

  • Filter using between SQL command

    SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2;

use the following logic:

  • User registered new START DATE and END DATE
  • Search for START DATE using BETWEEN into DATABASE
  • Search for END DATE using BETWEEN into DATABASE
  • If those values exists into ranges you can show duplicated message.

Regards C.