Keeping the code pretty generic here, but presumably you’re currently doing something like this:
// output a table header
while ($row = mysql_fetch_assoc($members)) {
// output a table row
}
// output a table footer
If you want to begin a new table periodically in that loop, you’d need to add a condition to determine when to do that. So the structure would be more like this:
$currentUser = 1;
// output a table header
while ($row = mysql_fetch_assoc($members)) {
// output a table row
if ($row["CurrentUser"] != $currentUser) {
// output a table footer
// output a table header
$currentUser = $row["CurrentUser"];
}
}
// output a table footer
This is pretty off-the-cuff, so there may be a logical mistake in here by which a partial table is displayed under certain conditions or something of that nature, admittedly. But hopefully the gist of the idea is being conveyed. Essentially within the loop you can close and re-open the table (putting whatever information from the data you have into those headers/footers) based on a condition. You just have to track the data being used in that condition. In this case, the “current” CurrentUser
value of the results.
1
solved Separate MYSQL results into separate HTML Tables