Skip to content

Instantly share code, notes, and snippets.

@kolyadin
Created January 15, 2014 09:54
Show Gist options
  • Save kolyadin/8433617 to your computer and use it in GitHub Desktop.
Save kolyadin/8433617 to your computer and use it in GitHub Desktop.
public function getUsersByCity($cityId, $from = 0, $count = -1){
$sql = <<<SQL
select
user.*
from
pn_users user
join pn_users_info info on (info.id = user.userInfo)
where
info.cityId = :cityId
order by
user.rating desc
SQL;
return MMC::getSet(md5(__METHOD__ . serialize(func_get_args())),strtotime('+1 month'),function() use($sql,$cityId,$from,$count){
return $this->fetchAll($sql . $this->getLimitString($from, $count),
[':cityId' => $cityId]
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment