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

added check for empty list

parent 159ab54a
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,14 @@ if (isset($_POST['group_id'])) { ...@@ -58,8 +58,14 @@ if (isset($_POST['group_id'])) {
$stmt = $db->prepare("SELECT UserID FROM ${DB_TABLE_PREFIX}users_to_groups WHERE GroupID = ?"); $stmt = $db->prepare("SELECT UserID FROM ${DB_TABLE_PREFIX}users_to_groups WHERE GroupID = ?");
$res = $stmt->execute(array($_REQUEST['group_id'])); $res = $stmt->execute(array($_REQUEST['group_id']));
$rownums = 0;
# Loop with rows # Loop with rows
while ($row = $stmt->fetchObject()) { while ($row = $stmt->fetchObject()) {
if ($row->userid != NULL) {
$rownums = $rownums + 1;
} else {
$rownums = $rownums - 1;
}
$sql = "SELECT ID, Username, Disabled FROM ${DB_TABLE_PREFIX}users WHERE ID = ".$row->userid; $sql = "SELECT ID, Username, Disabled FROM ${DB_TABLE_PREFIX}users WHERE ID = ".$row->userid;
$res = $db->query($sql); $res = $db->query($sql);
...@@ -77,6 +83,15 @@ if (isset($_POST['group_id'])) { ...@@ -77,6 +83,15 @@ if (isset($_POST['group_id'])) {
$res->closeCursor(); $res->closeCursor();
} }
$stmt->closeCursor(); $stmt->closeCursor();
if ($rownums <= 0) {
?>
<p />
<tr>
<td colspan="3" class="textcenter">Group has no users</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