I am trying put row['user'] into cell but it doesn't work.
When I uncomment "echo" it works fine.
PHP:
function mod_Something($database)
{
$sql = "SELECT user FROM table_name";
if ($result = mysqli_query($database, $sql)) {
while ($row = mysqli_fetch_assoc($result)) {
$html = $html . '<tr><td>' . $row['user'] . '</td></tr>';
// echo $row['user'];
}
return $html;
}
}
I also have a HTML view file where I have:
<table id="data-table-basic" class="table table-striped">
<thead>
<tr>
<th>user</th>
</tr>
</thead>
<tbody>
%mod_Something%
</tbody>
</table>
I know that HTML isn't a function but I must return it because there is a script which allows to return "view".