title: from date to date - search and display
body: <p>I have a database holding two bits of information. from date to date. I need this entry to appear in my calender on every day, but I can only manage to get to appear on the first and last date. </p>
  
  <p>example of DB:</p>
  
  <pre><code>   job_no | date1(from)| date2(to)
     ________________________________
     1      |2013-01-28  | 2013-02-03
     2      |2013-01-14  | 2013-01-18
  </code></pre>
  
  <p>Edit for question. the search bar I have allows for ONE date input and the the calender finds entries through date1 and the next 6 days. </p>
  
  <p>I cannot have a search which contains two date inputs because my users are so used to this way and i do not want to increase searching time. I started to think that I had to find the dates between the dates, add that to an <code>array</code> then use an <code>if statement</code> to find matches...but even saying this makes no sense to me. </p>
  
  <p>regarding job 1, I need my calender to show this job up on all dates 28/29/30/31/01/02/03. </p>
  
  <p>My current search <code>SELECT * FROM jobs WHERE date1='$searchinput'</code> PER day and calender this search. I use strtotime to increase the input date by +1 to add to the search for each day. </p>
  
  <p>Calender page.</p>
  
  <p>What I want with my results. User searched Date 28th.</p>
  
  <pre><code> Mon 28          |      Tues 29     |    Wed 30     ...... | Fri 03    |
  _________________________________________________________________________
     Job no 1      |      job no 1    |   job no 1    ...... | job no 1
  </code></pre>
  
  <p>What I have now.</p>
  
  <pre><code>  Mon 28       |      Tues 29     |    Wed 30     ...... | Fri 03    |
      _________________________________________________________________________
   Job no 1      |      blank       |      blank           | job no 1
  </code></pre>
  
  <p>each day has a new select query right now. It matches days with date 1 and date 2. I dont need this as before I only had jobs out on one day now they go out for more than one day and need the job to be noted on all days it is out by only using a job from date and job to date.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <pre><code>SELECT * FROM calender_db NATURAL JOIN job_db 
  WHERE section='two' 
  AND date1 &lt; '$day' AND date2 &gt; '$day' 
  OR date1 = '$day' OR date2 = '$day' 
  </code></pre>
  
  <p>This query selects what I need, but as I am using OR the first <code>WHERE</code> CLAUSE can be null. I need that to always be in the clause. I have been looking at using <code>IIF</code> or <code>CASE</code> to rectify but do not how to implement 100%...?</p>