summaryrefslogtreecommitdiffstats
path: root/app/class
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-07-26 03:52:21 -0400
committerMalf Furious <m@lfurio.us>2018-07-26 03:52:21 -0400
commit84b7c560ffc09a65df896116ccd63b2f132b92b0 (patch)
treea330d401fda5a961cfc65d7f63ea27fc43bfa92b /app/class
parent793d8852963a4266745a249b1557b485fe796f24 (diff)
downloadscrott-84b7c560ffc09a65df896116ccd63b2f132b92b0.tar.gz
scrott-84b7c560ffc09a65df896116ccd63b2f132b92b0.zip
Update function obj::getMembers()
Added a $limit argument to specify a maximum number of results to return.
Diffstat (limited to 'app/class')
-rw-r--r--app/class/obj.class.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/class/obj.class.php b/app/class/obj.class.php
index 5be9ac3..4e44649 100644
--- a/app/class/obj.class.php
+++ b/app/class/obj.class.php
@@ -144,12 +144,17 @@ class obj extends table
}
/*
- * Get an array of all members of this object
+ * Get an array of all members of this object. Limit of zero
+ * returns all members.
*/
- public function getMembers() : array
+ public function getMembers(int $limit = 0) : array
{
$memb = array();
$query = "SELECT member FROM members WHERE guid = '" . database::esc($this->guid) . "'";
+
+ if ($limit != 0)
+ $query .= " LIMIT " . database::esc($limit);
+
$res = database::query($query);
foreach ($res as $m)