title: MySQL- add Business hour that shop open two times per day after a break
body: <p>The restaurant opens Monday at 10 am till Tuesday 03 am and It opens again on Tuesday at 10 am till Wednesday 03 am.</p>
  
  <p>For example:<br>
  table: <code>business_hour</code></p>
  
  <pre><code>id | weedDay | openDay | openTime | closeDay | closeTime
  -----------------------------------------------------------
  1  | Monday  | Monday  | 10:00:00 | Tuesday  | 03:00:00 
  2  | Tuesday | Tuesday | 10:00:00 | Wednday  | 03:00:00
  </code></pre>
  
  <p>How to make MySQL SELECT sentence that shows is resturant open or not?</p>
  
  <pre><code>&lt;?php 
  
  require_once "pdo/pdo.php";
  
      try {
      $stmt = $pdo-&gt;prepare("
              SELECT 
               CASE WHEN
                  exists (
                    SELECT 1 FROM business_hour WHERE
                    (openday = dayname(now()) AND opentime &lt;= time(now()))
                    OR
                    (closeday = dayname(now()) AND closetime &gt;= time(now()))               
                  )
                  THEN 'Open'
                  ELSE 'Closed'
                END status
              ");
      $stmt-&gt;execute();
      while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC))
      {
          echo $row['status'];
      }
  
  
      } catch( PDOException $e ) {
          echo $e.'Not selected'; // error message
      }    
  ?&gt;
  </code></pre>