title: How can I create an automatic update on a web page based on date/time?
body: <p>I am managing an internet radio station webpage and I would like to add an auto entry for the station's programming based on the day of week / time of day. For example at 8.00am on a Monday to Friday the &quot;Now Playing&quot; title shows &quot;The Breakfast Show&quot;, at 10.00am it changes to &quot;The Fred and Lucy Hour&quot;, and on a Sunday at 6.00pm it shows &quot;The Hymn Hour&quot;&quot; etc. etc.</p>
  <p>I have worked out how to get the server date and time on the webpage using PHP, and I am guessing this should somehow be linked to an SQL Database which contains all the shows and their timings, but as a complete novice on all things PHP and SQL I have no idea how to link them together (if indeed it is possible) or whether any other additional programming is necessary.</p>
  <p>I would appreciate a steer in the right direction from someone better qualified than me.</p>
  <p>Thanks in advance.</p>
  <p>UPDATE:-
  For various reasons I chose to go with the coding based on an array of Weekdays / Times/ Shows and initially it seemed to work well until I realised that even though I set the &quot;$hour = date('H:i');&quot;, the code seemed to ignore the minutes in the array list. Following further advice (see comments below) I have overcome the problem and the code immediately below has been updated and is now in use. (Note I have shown a shortened test version of the array which can be amended and added to as required.):-</p>
  <pre><code>$shows = [
      3 =&gt; [
          '20:00' =&gt; 'Test result A',
          '20:30' =&gt; 'Test result B',
          '21:00' =&gt; 'Test result C',
          '21:10' =&gt; 'Test result D',
          '21:30' =&gt; 'Test result E'
      ],
  ];
  
  $weekday = date('N');
  $hour = date('H:i');
  $now_plaing = 'Default show';
      
  foreach($shows[$weekday] as $h=&gt;$show) {
      if ($h &lt;= $hour) $now_plaing = $show;
  
  printf(&quot;On Air Now: %s&quot;, $now_plaing);
  }
  </code></pre>