I’m running the below code to populate a HTML table using several “mysqli_queries”. The below snippet only shows three however i’m running ten in my file for various other date columns and may need more over time. I’ve attached a file below showing the basic database layout and required output
The required output is basically just a list of times form various columns
The below code works fine however its probably not the most efficient and other options like MySQL JOIN or UNION don’t seem to work
Do we have any another options to perform the desired output
$ result = mysqli_query($ con,"SELECT * FROM livescores WHERE actualstart >= '$ datefilter'"); $ resulthalf = mysqli_query($ con,"SELECT * FROM livescores WHERE actualhalftime >= '$ datefilter'"); $ actualft = mysqli_query($ con,"SELECT * FROM livescores WHERE actualft>= '$ datefilter'"); while($ row = mysqli_fetch_array($ result)) { echo "<tr>"; echo "<td>" . $ row['actualstart'] . "</td>"; echo "<td>" . $ row['League'] . "</td>"; echo "<td>KO</td>"; echo "<td>" . $ row['HomeTeam'] .' v '. $ row['AwayTeam'] . "</td>"; echo "<td></td>"; echo "</tr>"; } while($ row = mysqli_fetch_array($ resulthalf)) { echo "<tr>"; echo "<td>" . $ row['actualhalftime'] . "</td>"; echo "<td>" . $ row['League'] . "</td>"; echo "<td>HT</td>"; echo "<td>" . $ row['HomeTeam'] .' v '. $ row['AwayTeam'] . "</td>"; echo "<td></td>"; echo "</tr>"; } while($ row = mysqli_fetch_array($ actualft)) { echo "<tr>"; echo "<td>" . $ row['actualft'] . "</td>"; echo "<td>" . $ row['League'] . "</td>"; echo "<td>FT</td>"; echo "<td>" . $ row['HomeTeam'] .' v '. $ row['AwayTeam'] . "</td>"; echo "<td></td>"; echo "</tr>";
Many Thanks