diff options
author | Malf Furious <m@lfurio.us> | 2018-07-26 03:52:21 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-07-26 03:52:21 -0400 |
commit | 84b7c560ffc09a65df896116ccd63b2f132b92b0 (patch) | |
tree | a330d401fda5a961cfc65d7f63ea27fc43bfa92b /app | |
parent | 793d8852963a4266745a249b1557b485fe796f24 (diff) | |
download | scrott-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')
-rw-r--r-- | app/class/obj.class.php | 9 |
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) |