Having trouble using foreach to output the contents of a mysql table. The table (tr, td) etc is being printed out for each entry in the mysql table, but there is nothing between the td and /td tags, where each $item should be echoed.
$sql = 'SELECT domain FROM domainsuggestions';
$domains = mysqli_query($link, $sql); // get domain suggestions from table
<table>
<tr>
<td>Domain Suggestions</td>
</tr>
<?php foreach ($domains as $item): ?>
<tr>
<td><?php echo htmlspecialchars($item, ENT_QUOTES, 'UTF-8'); ?></td>
</tr>
<?php endforeach; ?>
</table>
Your logic for working with MySQL is quite off. You need to perform the query first, grab the resource ID of the results, and then loop through the results.