function noticesWithFriends($offset=0, $limit=20) {
$notice = new Notice();
-
- $notice->query('SELECT notice.* ' .
- 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' .
- 'WHERE subscription.subscriber = ' . $this->id . ' ' .
- 'ORDER BY created DESC, notice.id DESC ' .
- 'LIMIT ' . $offset . ', ' . $limit);
-
+
+ $query='SELECT notice.* ' .
+ 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' .
+ 'WHERE subscription.subscriber = ' . $this->id . ' ' .
+ 'ORDER BY created DESC, notice.id DESC ';
+ if(common_config('db','type')=='pgsql') {
+ $query=$query . 'LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $query=$query . 'LIMIT ' . $offset . ', ' . $limit;
+ }
+ $notice->query($query);
+
return $notice;
}