I have seven SQL queries that are being executed using the mysqli_multi_query function:
if (mysqli_multi_query($conn, $airlinesql)) {
do {
if ($result = mysqli_store_result($conn)) {
while ($row = mysqli_fetch_row($result)) {
HELP!!
}
mysqli_free_result($result);
}
} while (mysqli_next_result($conn));
}
//Build and fill HTML table
HELP!!
Each of the seven queries returns only one element per row, but the number of rows returned for each query is unknown - could even be NULL. I want each query result to populate its own separate column in an HTML table. In other words, the first query may return 5 rows each having only one element. I want each these 5 elements to go into its own row in the first column of the HTML table. The second query result may return 1 element. This element should reside in row 1 of the second column. Etc. Although number of rows returned per query is unknown (and could even be null), the number of columns is fixed at 7 (since that is the number of queries). I'm guessing tossing all results into an array is the right idea, but I can't figure out how to build the table from the array using while/for loops since you typically build by row whereas my thinking is stuck with building by column due to the unknown number of rows returned per query. Or, maybe there's a better way than using mysqli_multi_query? Thanks for your help.