That would be the general pattern. I might first do a mysqli_num_rows() check to handle any case where you get zero rows returned. Assuming it's >= 1, then the basic idea would be to output your table tag and probably a <tr>...</tr> line with <th>...</th> elements for the table column headers, then do your while() loop, including <tr> and </tr> tags wrapping up the rows, e.g.:
while($row = mysqli_fetch_assoc($ret)) {
echo "<tr>";
foreach(array('col_1', 'col_2', 'etc') as $key) { // replace actual column names in array
echo "<td>".htmlspecialchars($row[$key])."</td>";
}
echo "</tr>\n";
}
Then stick your closing </table> tag after the end of the loop.