I really want this echo to not include people not listed as 1 in the row "activated" in my database. So if its 0 they wont show.
// Print each user
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>{$row['username']}</td>
<td><a href='{$row['website']}' class='example7'>{$row['website']}</a></td>
<td align='center'>{$row['disabled']}</td>
</tr>";
}
// Close table
echo '</table>';
Full code
<?php
if (!isLoggedIn())
{
// user is not logged in.
if (isset($_POST['cmdlogin']))
{
// User is not logged in and has not pressed the login button
// so we show him the loginform
show_loginform();
{
echo "You are not logged in or you do not have permission to access this page.";
}
}
} else
{
// Connect to the database
$dbLink = new mysqli('xxxxx', 'xxxxxx', 'xxxxxx', 'xxxxxxxx');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Query for a list of all existing files
$sql = 'SELECT `loginid`, `username`, `website`, `disabled` FROM `login` ORDER BY `loginid`';
$result = $dbLink->query($sql);
// Check if it was successfull
if($result) {
// Make sure there are some files in there
if($result->num_rows == 0) {
echo '<p>There are no users in the database!</p>';
}
else {
// Print the top of a table
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr class="myFiles-thtable">
<th width="150"><p><font color="black">Name</font></p></th>
<th width="150"><p><font color="black">Website</font></p></th>
<th width="150"><p><font color="black">Banned</font></p></th>
</tr>
';
// Print each user
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>{$row['username']}</td>
<td><a href='{$row['website']}' class='example7'>{$row['website']}</a></td>
<td align='center'>{$row['disabled']}</td>
</tr>";
}
// Close table
echo '</table>';
}
// Free the result
$result->free();
}
else
{
echo 'Error! SQL query failed:';
echo "<pre>{$dbLink->error}</pre>";
}
// Close the mysql connection
$dbLink->close();
}
?>