I need some help regarding displaying multiple MySQL records where the date values are the same.
Example:
==========================
31 July
Record 1
2 August
Record 2
Record 3
5 August
Record 4
Record 5
6 August
Record 6
==========================
MySQL records example data:
nid | neventName | nstartDate
----+------------+-----------
| 1 | Record 1 | 2018-07-31
| 2 | Record 2 | 2018-08-02
| 3 | Record 3 | 2018-08-02
| 4 | Record 4 | 2018-08-05
| 5 | Record 5 | 2018-08-05
| 6 | Record 6 | 2018-08-08
My code for this section is the following:
<?php
//DATE VALUES
date_default_timezone_set('Asia/Dubai');
$currentDate = date("Y-m-d");
$startDate = $rs_EventsVenuesListing_rows['nstartDate'];
$date = date_create($startDate);
//CREATE SQL STATEMENT
$sql_EventsVenuesListing = "SELECT * FROM tblvenueListingsEvents WHERE $currentDate <= nstartDate ORDER BY nstartDate ASC";
//$sql_EventsVenuesListing = "SELECT DISTINCT nstartDate FROM tblvenueListingsEvents WHERE $currentDate <= nstartDate ORDER BY nstartDate ASC";
//CONNECT TO MYSQL SERVER
require('inc-conn.php');
//EXECUTE SQL STATEMENT
$rs_EventsVenuesListing = mysqli_query($vconn, $sql_EventsVenuesListing);
//CREATE AN ASSOCIATIVE ARRAY
//$rs_EventsVenuesListing_rows = mysqli_fetch_assoc($rs_EventsVenuesListing);
?>
<?php
echo "<table border = 1px>";
while ($rs_EventsVenuesListing_rows = mysqli_fetch_assoc($rs_EventsVenuesListing)) {
// printing table row
// ##### DISPLAY ALL DATES USING START DATE FROM EVENTS #####
echo'<tr>';
echo '<td>'.$rs_EventsVenuesListing_rows['nstartDate'].'</td>';
echo'</tr>'; // closing table row
// ##### DISPLAY ALL EVENTS THAT HAS THE SAME START DATE #####
if ($startDate = $startDate) {
echo'<tr>';
echo '<td>'.$rs_EventsVenuesListing_rows['neventName'].'</td>';
echo'</tr>'; // closing table row
}
echo'<tr>';
echo '<td><br></td>';
echo'</tr>'; // closing table row
}
echo '</table>';
?>
<!-- ######################## DISPLAY DATES ######################## -->
Your assistance will gladly be appreciated.
Regards,
Dane