Skip to content
Snippets Groups Projects
Commit cf354883 authored by Robert Anderson's avatar Robert Anderson
Browse files

Added check for empty list

parent 0e48d001
No related branches found
No related tags found
No related merge requests found
...@@ -74,17 +74,31 @@ if (!isset($_POST['frmaction'])) ...@@ -74,17 +74,31 @@ if (!isset($_POST['frmaction']))
$sql = "SELECT ID, Username, Disabled FROM ${DB_TABLE_PREFIX}users ORDER BY ID ASC"; $sql = "SELECT ID, Username, Disabled FROM ${DB_TABLE_PREFIX}users ORDER BY ID ASC";
$res = $db->query($sql); $res = $db->query($sql);
$rownums = 0;
# List users # List users
while ($row = $res->fetchObject()) { while ($row = $res->fetchObject()) {
if ($row->id != NULL) {
$rownums = $rownums + 1;
} else {
$rownums = $rownums - 1;
}
?> ?>
<tr class="resultsitem"> <tr class="resultsitem">
<td><input type="radio" name="user_id" value="<?php echo $row->id ?>"/><?php echo $row->id ?></td> <td><input type="radio" name="user_id" value="<?php echo $row->id ?>"/><?php echo $row->id ?></td>
<td><?php echo $row->username ?></td> <td><?php echo $row->username ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr> </tr>
<?php <?php
} }
$res->closeCursor(); $res->closeCursor();
if ($rownums <= 0) {
?>
<tr>
<td class="textcenter">Group list is empty</td>
</tr>
<?php
}
unset($rownums);
?> ?>
</table> </table>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment