I created this table with data from the database. table: https://imgur.com/06xnebJ
I need all the rows with month May to be in 1 row like this:
May 2019 | | 3 | 3| 2| etc.
My DB looks like this:
So far I got this code
$tipsportsql = mysqli_query($conn, "SELECT DATE_FORMAT(datum, '%b %Y') AS 'Monthyear', count(projekt) AS 'project' FROM zapasy WHERE projekt = '0' AND komentator1 = '$firstname $lastname' OR projekt = '0' AND komentator2 = '$firstname $lastname' GROUP BY Monthyear");
$slaviasql = mysqli_query($conn, "SELECT DATE_FORMAT(datum, '%b %Y') AS 'Monthyear', count(projekt) AS 'project' FROM zapasy WHERE projekt = '1' AND komentator1 = '$firstname $lastname' OR projekt = '1' AND komentator2 = '$firstname $lastname' GROUP BY Monthyear");
$betsql = mysqli_query($conn, "SELECT DATE_FORMAT(datum, '%b %Y') AS 'Monthyear', count(projekt) AS 'project' FROM zapasy WHERE projekt = '2' AND komentator1 = '$firstname $lastname' OR projekt = '2' AND komentator2 = '$firstname $lastname' GROUP BY Monthyear");
and this
<tbody>
<?php while ($tip = mysqli_fetch_assoc($tipsportsql)) {?>
<tr>
<td>
<?=$tip['Monthyear'] ?>
</td>
<td>
</td>
<td>
</td>
<td>
<?=$tip['project']?>
</td>
</tr>
<?php } while ($tip = mysqli_fetch_assoc($slaviasql)) {?>
<tr>
<td>
<?=$tip['Monthyear'] ?>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
<?=$tip['project']?>
</td>
</tr>
<?php }while ($tip = mysqli_fetch_assoc($betsql)) {?>
<tr>
<td>
<?=$tip['Monthyear'] ?>
</td>
<td>
</td>
<td>
<?=$tip['project']?>
</td>
<td>
</td>
<td>
</td>
</tr>
<?php }?>
</tbody>
I am thankful for any help.