title: Auto insert MySQL using Events in phpMyAdmin
body: <p>I have table Schedule. </p>
  
  <pre><code>CREATE TABLE Schedule (
  id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  Program VARCHAR(30) NOT NULL,
  Time DATETIME NOT NULL)
  </code></pre>
  
  <p>In one day there are many programs, for example:</p>
  
  <p>Monday</p>
  
  <ol>
  <li>program x || 17:00</li>
  <li>program y || 18:00</li>
  </ol>
  
  <p>.....</p>
  
  <p>Tuesday</p>
  
  <ol>
  <li>Program a || 10:00</li>
  <li>Program b || 12:00</li>
  </ol>
  
  <p>.....</p>
  
  <p>until sunday.</p>
  
  <p>I want to trigger every day, it will check if there is a data in that day next week. So in monday 14/09/2015 will check the next monday 21/09/2015.  If there is no data in that day, it will insert copy of data in last monday.</p>
  
  <p>Maybe the logic or the psuedo code will be like this</p>
  
  <pre><code>IF (Current date + 7 days IS NULL)
  Then
  INSERT INTO SCHEDULE (program, time)
  VALUES ( (Select Program FROM SCHEDULE Where Day(Sysdate()) = Day(Time)),
           (select Time FROM SCHEDULE Where Day(sysdate()=Day(Time))+7 Day) )
  </code></pre>
  
  <p>My question is i don't know the proper query to insert copy of today program with same time(HH:MM) but different Date.BTW Im Using php MyAdmin Event like this<a href="https://i.stack.imgur.com/L9QyX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L9QyX.png" alt="enter image description here"></a></p>