I would like to print days of month and highlight the days witch are same like dates in my MySQL table.
There are rows of runs in table (day of run, distance, speed ...) and I would like to highlight days of month when I run.
My code:
$user="1";
$dbmonth="201806";
$month = date('m');
$year = date('Y');
$days = date('t');
for($d=1; $d<=$days; $d++)
{
$time=mktime(12, 0, 0, $month, $d, $year);
if (date('m', $time)==$month)
$list=date('Y-m-d', $time);
$select1cal = mysqli_query($conn, "SELECT * FROM runs WHERE user=$user AND dbmonth=$dbmonth ORDER BY date");
while($data=mysqli_fetch_array($select1cal)) {
$dateid1=$data['date'];
$event1=date('Y-m-d', $dateid1);
if ($list == $event1) {$show="<p style=\"color:#0f0;\">$list</p>";} else {$show="<p>$list</p>";}
}
echo $show;
}
This code print all days of month (2018-06-01 to 2018-06-30) but highlighted is only one date. How can I highlight all of dates from table? For example there are 4 rows with date between 2018-06-01 and 2018-06-30 in my table.
Here is output of my code:
<p>2018-06-01</p>
<p>2018-06-02</p>
<p>2018-06-03</p>
<p>2018-06-04</p>
<p>2018-06-05</p>
<p>2018-06-06</p>
<p>2018-06-07</p>
<p>2018-06-08</p>
<p>2018-06-09</p>
<p>2018-06-10</p>
<p>2018-06-11</p>
<p>2018-06-12</p>
<p style="color:#0f0;">2018-06-13</p>
<p>2018-06-14</p>
<p>2018-06-15</p>
<p>2018-06-16</p>
<p>2018-06-17</p>
<p>2018-06-18</p>
<p>2018-06-19</p>
<p>2018-06-20</p>
<p>2018-06-21</p>
<p>2018-06-22</p>
<p>2018-06-23</p>
<p>2018-06-24</p>
<p>2018-06-25</p>
<p>2018-06-26</p>
<p>2018-06-27</p>
<p>2018-06-28</p>
<p>2018-06-29</p>
<p>2018-06-30</p>