本文整理汇总了PHP中S::sqlLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP S::sqlLimit方法的具体用法?PHP S::sqlLimit怎么用?PHP S::sqlLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::sqlLimit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllFriend
function getAllFriend($uid, $offset, $limit)
{
list($uid, $offset, $limit) = array(intval($uid), intval($offset), intval($limit));
if ($uid < 1) {
return $this->buildResponse(Friend_INVALID_PARAMS);
}
$uids = array();
$count = $GLOBALS['db']->get_value("SELECT COUNT(*) as count FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid));
if ($count < 1) {
return $this->buildResponse(0, array());
}
$sqlLimit = $offset > 0 ? ' AND friendid > ' . S::sqlLimit($offset) : '';
$query = $GLOBALS['db']->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . $sqlLimit . " ORDER BY friendid ASC LIMIT " . intval($limit));
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$uids[] = $rt['friendid'];
}
if (!S::isArray($uids)) {
return $this->buildResponse(0, array());
}
$userService = L::loadClass('UserService', 'user');
$userInfos = $userService->getByUserIds($uids);
require_once R_P . 'require/showimg.php';
$result = array();
foreach ($userInfos as $userInfo) {
$tmpIcon = showfacedesign($userInfo['icon'], 1, 's');
$result[] = array('uid' => $userInfo['uid'], 'icon' => $tmpIcon[0], 'username' => $userInfo['username']);
}
return $this->buildResponse(0, array('friends' => $result, 'count' => $count));
}
示例2: toppedClassifyTopic
/**
*
* 获取最新置顶分类信息
* @param array $modelid 分类信息id
* @param string $fid 版块id
* @param int $num 调用个数
* @return array
*/
function toppedClassifyTopic($modelid, $fid, $num)
{
$posts = array();
$sqlWhere = $this->_buildCondition($modelid, $fid);
$sqlWhere .= ' AND topped != 0';
$query = $this->_db->query('SELECT tid,fid,modelid,author,authorid,subject,postdate,anonymous FROM ' . $this->_tableName . $sqlWhere . ' AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC' . S::sqlLimit(0, $num));
$posts = $this->_cookData($query);
return $posts;
}
示例3: _getFirstPostNoCache
function _getFirstPostNoCache($postTable, $tid, $limit, $offset)
{
$readdb = array();
$limit = S::sqlLimit($limit, $offset);
$query = $GLOBALS['db']->query("SELECT t.* FROM {$postTable} t WHERE t.tid=" . S::sqlEscape($tid) . " AND t.ifcheck='1' ORDER BY t.postdate ASC {$limit}");
while ($read = $GLOBALS['db']->fetch_array($query)) {
$readdb[] = $read;
}
return $readdb;
}
示例4: getThreadsByLastPost
function getThreadsByLastPost($startTime, $endTime, $page, $perpage)
{
list($startTime, $endTime, $page, $perpage) = array(intval($startTime), intval($endTime), intval($page), intval($perpage));
if ($startTime < 1 || $endTime < 1 || $startTime > $endTime || $page < 1 || $perpage < 1) {
return array();
}
$offset = ($page - 1) * $perpage;
$query = $GLOBALS['db']->query("SELECT t.*,f.name as forumname FROM pw_threads t LEFT JOIN pw_forums f USING(fid) WHERE t.fid != 0 AND t.ifcheck = 1 AND t.lastpost >= " . S::sqlEscape($startTime) . " AND lastpost <= " . S::sqlEscape($endTime) . S::sqlLimit($offset, $perpage));
return $this->getThreadDataWithTmsgs($query);
}
示例5: getEffectInvokePushDatas
function getEffectInvokePushDatas($invokepieceid, $num = 10)
{
global $timestamp;
$temp = array();
$query = $this->_db->query("SELECT * FROM " . $this->_tableName . " WHERE invokepieceid=" . S::sqlEscape($invokepieceid) . " AND ifverify=0 AND starttime<=" . S::sqlEscape($timestamp) . " ORDER BY vieworder DESC,starttime DESC " . S::sqlLimit(0, $num));
while ($rt = $this->_db->fetch_array($query)) {
$temp[$rt['id']] = $this->_initData($rt);
}
return $temp;
}
示例6: getCertificateInfo
function getCertificateInfo($start, $limit, $state)
{
if ($state) {
$where = 'WHERE state=' . S::sqlEscape($state);
} else {
$where = 'WHERE state>0';
}
$query = $this->_db->query("SELECT * FROM {$this->_tableName} {$where} ORDER BY id DESC" . S::sqlLimit($start, $limit));
return $this->_getAllResultFromQuery($query, 'uid');
}
示例7: getAllFieldsWithPages
/**
* 分页取得所有字段信息
* @param int $start 起始位置
* @param int $num 数量
* @return array
*/
function getAllFieldsWithPages($start, $num)
{
$fields = array();
$start = (int) $start;
$num = (int) $num;
if ($start < 0 || $num < 1) {
return $fields;
}
$query = $this->_db->query('SELECT * FROM ' . $this->_tableName . ' ORDER BY vieworder ASC' . S::sqlLimit($start, $num));
return $this->_getAllResultFromQuery($query, $this->_primaryKey);
}
示例8: searchPageInvokes
function searchPageInvokes($array, $page, $prePage = 20)
{
$page = (int) $page - 1 < 0 ? 0 : (int) $page - 1;
$temp = array();
$_sql = "SELECT p.*,i.title,i.name FROM " . $this->_tableName . " p LEFT JOIN " . $this->_joinTable . " i ON p.invokename=i.name" . $this->_getSearchSql($array, 1) . ' ORDER by p.state ASC, p.id ASC ' . S::sqlLimit($page * $prePage, $prePage);
$query = $this->_db->query($_sql);
while ($rt = $this->_db->fetch_array($query)) {
$rt = $this->_unserializeData($rt);
$temp[] = $rt;
}
return $temp;
}
示例9: getAll
function getAll($condition = array(), $page, $prePage = 20)
{
$page = (int) $page;
$page = $page - 1;
$page <= 0 && ($page = 0);
$_sql = $this->_cookSql($condition);
$query = $this->_db->query("SELECT * FROM " . $this->_tableName . " " . $_sql . " ORDER BY apply_id DESC " . S::sqlLimit($page * $prePage, $prePage));
$temp = array();
while ($rt = $this->_db->fetch_array($query)) {
$temp[] = $rt;
}
return $temp;
}
示例10: getColonyList
function getColonyList($where, $nums = null, $start = 0)
{
$sql = $this->_sqlCompound($where);
$limit = '';
if ($nums) {
$limit = S::sqlLimit($start, $nums);
}
$array = array();
$query = $this->_db->query("SELECT * FROM pw_colonys WHERE 1" . $sql . $limit);
while ($rt = $this->_db->fetch_array($query)) {
$array[$rt['id']] = $rt;
}
return $array;
}
示例11: findAll
function findAll($array, $page, $perPage = 20)
{
$_sql_add = $this->_getSearchSQL($array);
if ($perPage) {
$limit = S::sqlLimit(($page - 1) * $perPage, $perPage);
}
$_sql = "SELECT * FROM " . $this->_tableName . " WHERE 1 {$_sql_add} " . $limit;
$temp = array();
$query = $this->_db->query($_sql);
while ($rt = $this->_db->fetch_array($query)) {
$temp[] = $this->_unserializeData($rt);
}
return $temp;
}
示例12: getSortByTypeAndClassId
function getSortByTypeAndClassId($type, $classID, $num)
{
$_sqlAdd = $this->_getClassidAdd($classID);
$white = array('tnum', 'pnum', 'members', 'todaypost', 'createtime', 'credit');
if (!$type || !in_array($type, $white)) {
$type = 'tnum';
}
$_sql_type = $type == 'credit' ? 'credit' : 'c.' . $type;
$_sql_credit = $this->_getCreditAdd($type);
$_sql = "SELECT c.id,c.styleid,c.cname,c.tnum,c.pnum,c.members,c.todaypost,c.createtime,c.cnimg,c.descrip,s.cname as stylename {$_sql_credit} FROM " . $this->_tableName . " c LEFT JOIN pw_cnstyles s ON c.styleid=s.id WHERE 1 {$_sqlAdd} ORDER BY {$_sql_type} DESC " . S::sqlLimit(0, $num);
$temp = array();
$query = $this->_db->query($_sql);
while ($rt = $this->_db->fetch_array($query)) {
$temp[$rt['id']] = $rt;
}
return $temp;
}
示例13: getAppUsers
function getAppUsers($appid, $uid, $num, $start = 0)
{
if ($num == 'all') {
$num = 500;
} elseif (!is_numeric($num) || $num < 1) {
$num = 20;
} elseif ($num > 500) {
$num = 500;
}
(!is_numeric($start) || $start < 0) && ($start = 0);
$users = $appusers = array();
$query = $this->db->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . S::sqlLimit($start, $num));
while ($rt = $this->db->fetch_array($query)) {
$users[] = $rt['friendid'];
}
$query = $this->db->query("SELECT uid FROM pw_userapp WHERE uid IN (" . S::sqlImplode($users) . ") AND appid=" . S::sqlEscape($appid));
while ($rt = $this->db->fetch_array($query)) {
$appusers[] = $rt['uid'];
}
return new ApiResponse($appusers);
}
示例14: get
function get($appid, $uid, $num, $start = 0)
{
if ($num == 'all') {
$num = 500;
} elseif (!is_numeric($num) || $num < 1) {
$num = 20;
} elseif ($num > 500) {
$num = 500;
}
(!is_numeric($start) || $start < 0) && ($start = 0);
$users = array();
$query = $this->db->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid) . S::sqlLimit($start, $num));
$appclient = L::loadClass('appclient');
while ($rt = $this->db->fetch_array($query)) {
//$app = $this->db->get_one("SELECT * FROM pw_userapp WHERE uid=".S::sqlEscape($rt['friendid'])." AND appid=".S::sqlEscape($appid));
$app = $appclient->getUserAppByUidAndAppid($rt['friendid'], $appid);
if (empty($app)) {
$users[] = $rt['friendid'];
}
}
return new ApiResponse($users);
}
示例15: _getDataForSort
function _getDataForSort($type, $groupId, $num)
{
global $db;
$_sql_order = $type == 'newarticle' ? 'a.tid' : 'a.lastpost';
$groupId = (int) $groupId;
$_sqlAddArray = array();
if ($groupId) {
$_sqlAddArray[] = 'a.cyid=' . S::sqlEscape($groupId);
}
if ($type == 'newreplye') {
$_sqlAddArray[] = 't.replies>0';
}
$_sqlAddArray[] = '!(t.fid=0 AND t.ifcheck=1)';
$_sqlAddArray[] = 'cy.ifopen=1';
$_sqlAdd = $_sqlAddArray ? ' WHERE ' . implode(' AND ', $_sqlAddArray) : ' ';
$_sql = "SELECT t.tid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastposter,a.cyid,a.lastpost,cy.cname FROM pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid LEFT JOIN pw_colonys cy ON a.cyid=cy.id {$_sqlAdd} ORDER BY {$_sql_order} DESC" . S::sqlLimit(0, $num);
$query = $db->query($_sql);
$temp = array();
while ($rt = $db->fetch_array($query)) {
$temp[] = $this->_cookData($rt);
}
return $temp;
}