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();
}
?>

You can do this directly in the sql so you never receive unactivated users.

SELECT `loginid`, `username`, `website`, `disabled` 
FROM `login`
WHERE activated = 1
ORDER BY `loginid`

In your query you also reference a 'disabled' column. So assuming that disabled gets set to '1' when a user is disabled and you also want to exclude them (to see only active users):

SELECT `loginid`, `username`, `website`, `disabled` 
FROM `login`
WHERE activated = 1
  AND disabled != 1
ORDER BY `loginid`
commented: Organized problem killer! +1

wow! pretty simple when you know the tricks, thanks allot madCoder!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.