I struggle to echo content of certain columns from certain tables depends on user selection - for now I had only one table and code below work perfect but certainly other tables don't have same col names and values so I try to modify it - so far I'm stuck.How can I make it dynamic?
humble ask for some help :)
<?php
function showTables($table, $order) {
global $conn;
$query = ("SELECT * FROM $table ORDER BY $order ASC LIMIT 0, 30 ");
$returnTables = mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($returnTables)) {
$id = $row['id'];
$name = $row['name'];
$surrname = $row['surrname'];
$email = $row['email'];
$firstTime = $row['firstTime'];
$comment = $row['comment'];
echo "<tr>";
echo "<td>$name</td>";
echo "<td>$surrname</td>";
echo "<td>$email</td>";
echo "<td>$firstTime</td>";
echo "<td>$comment</td>";
echo "<td class='no-print'><a href='admin.php?delete={$id}'>Usuń</a></td>";
echo "</tr>";
}
}
?>