title: Stop insertion of record in tabe if the start_date and end_date is bettween start_date and end_date php mysql
body: <p>I have a table in which task is assigned to users with start date and end date. I want to do is check if a user is available for the task which he is being assigned mean check is their any task is assigned to him between the given date. If it is then restrict the user from added the record.</p>
  
  <p>For example if the user is assigned task where <code>start_date is 23-06-2015</code> <code>end_date is 23-08-2015.</code> Then when i add new task with date between above start_date and end_date then it should return record with the below query. It is working for some records but for input like <code>start_date  23-06-2015</code> and <code>end_date 23-06-2015</code> it is not working.</p>
  
  <p>Here is my Query for check availability if record found then return the record</p>
  
  <pre><code>SELECT t.*
  FROM task t
  INNER JOIN project p ON p.id = t.pid
  INNER JOIN USER u ON u.uid = t.uid
  INNER JOIN STATUS st ON st.id = t.id
  WHERE t.uid = 6 AND (t.start_date BETWEEN  '2015-06-23' AND '2015-08-23'  OR t.end_date BETWEEN '2015-06-23' AND '2015-08-23') AND t.pid IN (
  SELECT id
  FROM project) AND st.status = 0 AND t.etype='task'
  </code></pre>