本文整理汇总了PHP中S::sqlImplode方法的典型用法代码示例。如果您正苦于以下问题:PHP S::sqlImplode方法的具体用法?PHP S::sqlImplode怎么用?PHP S::sqlImplode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::sqlImplode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_reply
function get_reply($uid, $num = 20)
{
$pw_posts = GetPtable($GLOBALS['db_ptable']);
$array = $tTable = $tids = array();
$query = $this->_db->query("SELECT DISTINCT tid,pid FROM {$pw_posts} WHERE authorid=" . S::sqlEscape($uid) . " AND ifcheck=1 AND fid!=0 ORDER BY postdate DESC " . S::sqlLimit($num));
while ($rt = $this->_db->fetch_array($query)) {
$tids[] = $rt['tid'];
$pids[$rt[tid]][] = $rt['pid'];
}
if ($tids) {
$query = $this->_db->query("SELECT t.tid,t.subject,t.replies,t.hits,t.postdate,f.fid as forumsid,f.name as forums FROM pw_threads t LEFT JOIN pw_forums f ON t.fid=f.fid WHERE t.tid IN(" . S::sqlImplode($tids) . ") ORDER BY t.tid DESC");
while ($rt = $this->_db->fetch_array($query)) {
$rt['subject'] = substrs($rt['subject'], 45);
$rt['forums'] = substrs(stripWindCode($rt['forums']), 100, 'N');
list($rt['postdate']) = getLastDate($rt['postdate']);
$rt['pid'] = $pids[$rt[tid]][0];
$tTable[getTtable($rt['tid'])][] = $rt['tid'];
$array[$rt['tid']] = $rt;
}
foreach ($tTable as $pw_tmsgs => $ids) {
$query = $this->_db->query("SELECT tid,content FROM {$pw_tmsgs} WHERE tid IN (" . S::sqlImplode($ids) . ')');
while ($rt = $this->_db->fetch_array($query)) {
$array[$rt['tid']]['content'] = substrs(stripWindCode($rt['content']), 100, 'N');
}
}
}
return $array;
}
示例2: updateForumCount
function updateForumCount($fid, $topic, $replies, $tpost = 0)
{
global $db, $db_fcachenum;
$fm = $db->get_one("SELECT fup,type,password,allowvisit,f_type FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
if ($fm['type'] == 'category') {
return false;
}
delfcache($fid, $db_fcachenum);
$topic = intval($topic);
$article = $topic + intval($replies);
$tpost = intval($tpost);
$lastpost = '';
$lt = $db->get_one("SELECT tid,author,postdate,lastpost,lastposter,subject FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort='0' AND ifcheck='1' AND lastpost>0 ORDER BY lastpost DESC LIMIT 1");
if ($lt) {
if ($lt['postdate'] == $lt['lastpost']) {
$subject = substrs($lt['subject'], 26);
} else {
$subject = 'Re:' . substrs($lt['subject'], 26);
}
$lastpost = ",lastpost=" . S::sqlEscape($subject . "\t" . $lt['lastposter'] . "\t" . $lt['lastpost'] . "\t" . "read.php?tid={$lt['tid']}&page=e#a");
}
$db->update("UPDATE pw_forumdata SET article=article+'{$article}',topic=topic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid=" . S::sqlEscape($fid));
Perf::gatherInfo('changeForumData', array('fid' => $fid));
if (($fm['type'] == 'sub' || $fm['type'] == 'sub2') && ($fids = getUpFids($fid))) {
if ($fm['password'] != '' || $fm['allowvisit'] != '' || $fm['f_type'] == 'hidden') {
$lastpost = '';
}
$db->update("UPDATE pw_forumdata SET article=article+'{$article}',subtopic=subtopic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid IN(" . S::sqlImplode($fids) . ')');
Perf::gatherInfo('changeForumData', array('fid' => $fids));
}
}
示例3: deleteByTids
/**
* 根据tids批量删除数据
*
* @param int $tid
* @return array
*/
function deleteByTids($tids)
{
if (!S::isArray($tids)) {
return false;
}
return $this->_db->update("DELETE FROM " . $this->_tableName . " WHERE tid IN (" . S::sqlImplode($tids) . ")");
}
示例4: getThreadsByReplies
/**
* @param $replies
* @param $order
* @param $isDesc
* @param $page
* @return unknown_type
*/
function getThreadsByReplies($replies, $page)
{
if (!$replies) {
return;
}
$sql = "SELECT p.tid FROM pw_postsfloor p GROUP BY p.tid ORDER BY p.tid DESC";
$query = $this->db->query($sql);
while ($rt = $this->db->fetch_array($query)) {
$tid[] = $rt['tid'];
}
if ($tid) {
$w_tid = " t.tid NOT IN ( " . S::sqlImplode($tid) . " ) AND ";
}
$sql = "SELECT COUNT(*) AS sum FROM pw_threads t WHERE {$w_tid} t.replies > " . S::sqlEscape($replies);
$rt = $this->db->get_one($sql);
(!is_numeric($page) || $page < 1) && ($page = 1);
$limit = S::sqlLimit(($page - 1) * $this->db_perpage, $this->db_perpage);
$result['pages'] = numofpage($rt['sum'], $page, ceil($rt['sum'] / $this->db_perpage), $this->basename . "&sub=y&action=search&replies={$replies}&");
$sql = "SELECT t.tid, t.subject, t.replies, t.postdate, t.fid\n\t\t\t\tFROM pw_threads t\n\t\t\t\tWHERE {$w_tid} t.replies > " . S::sqlEscape($replies) . " {$limit}";
$query = $this->db->query($sql);
while ($rt = $this->db->fetch_array($query)) {
list($lastDate) = PostIndexUtility::getLastDate($rt["postdate"]);
$rt["postdate"] = $lastDate;
$result['data'][] = $rt;
}
return $result;
}
示例5: searchAllFriend
function searchAllFriend($uid, $keyword, $offset, $limit)
{
list($uid, $keyword, $offset, $limit) = array(intval($uid), trim($keyword), intval($offset), intval($limit));
if ($uid < 1 || !$keyword) {
$this->buildResponse(Friend_INVALID_PARAMS);
}
$keyword = ACloud_Sys_Core_Common::convert($keyword, ACloud_Sys_Core_Common::getGlobal('g_charset'), 'UTF-8');
$uids = array();
$query = $GLOBALS['db']->query("SELECT friendid FROM pw_friends WHERE status='0' AND uid=" . S::sqlEscape($uid));
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$uids[] = $rt['friendid'];
}
if (!S::isArray($uids)) {
return $this->buildResponse(0, array());
}
list($result, $uids) = array(array(), array_slice($uids, 0, 150));
$count = $GLOBALS['db']->get_value("SELECT COUNT(*) as count FROM pw_members WHERE username LIKE " . S::sqlEscape("%{$keyword}%") . " AND uid IN (" . S::sqlImplode($uids) . ")");
if ($count < 1) {
return $this->buildResponse(0, array());
}
$sqlLimit = $offset > 0 ? ' AND uid > ' . S::sqlEscape($offset) : '';
$query = $GLOBALS['db']->query("SELECT uid,icon,username FROM pw_members WHERE username LIKE " . S::sqlEscape("%{$keyword}%") . " AND uid IN (" . S::sqlImplode($uids) . ") {$sqlLimit} ORDER BY uid ASC LIMIT " . intval($limit));
require_once R_P . 'require/showimg.php';
while ($rt = $GLOBALS['db']->fetch_array($query)) {
$tmpIcon = showfacedesign($rt['icon'], 1, 's');
$result[] = array('uid' => $rt['uid'], 'username' => $rt['username'], 'icon' => $tmpIcon[0]);
}
return $this->buildResponse(0, array('count' => $count, 'friends' => $result));
}
示例6: getSchoolsBySchoolIds
/**
* 根据多个学院ID获取数据
* @param array schoolIds
* @return array
*/
function getSchoolsBySchoolIds($schoolIds)
{
if (!S::isArray($schoolIds)) {
return array();
}
$query = $this->_db->query("SELECT * FROM {$this->_tableName} WHERE schoolid IN (" . S::sqlImplode($schoolIds) . ")");
return $this->_getAllResultFromQuery($query, 'schoolid');
}
示例7: getDataByIds
/**
* 根据IDs获得记录信息
* @param array $ids
* @return multitype:
*/
function getDataByIds($ids)
{
if (empty($ids) || !is_array($ids)) {
return array();
}
$query = $this->_db->query("SELECT w.*, m.* FROM {$this->_tableName} w LEFT JOIN pw_members m \n\t\t\tON w.uid=m.uid WHERE w.id IN (" . S::sqlImplode($ids) . ") ORDER BY w.id DESC");
return $this->_getAllResultFromQuery($query);
}
示例8: getAttentionedTopicByTopicIds
/**
*
* 检查是否已经关注某些话题
* @param int $topicIds
* @param int $userid
* @return array
*/
function getAttentionedTopicByTopicIds($topicIds, $userid)
{
if (!$userid && !S::isArray($topicIds)) {
return array();
}
$query = $this->_db->query('SELECT userid,topicid FROM ' . $this->_tableName . ' WHERE userid = ' . $this->_addSlashes($userid) . ' AND topicid IN (' . S::sqlImplode($topicIds) . ')');
return $this->_getAllResultFromQuery($query, 'topicid');
}
示例9: getFloorsByPids
function getFloorsByPids($pids)
{
$query = $this->_db->query("SELECT floor FROM " . $this->_tableName . " WHERE pid IN(" . S::sqlImplode($pids) . ")");
while ($rt = $this->_db->fetch_array($query)) {
$robFloors[] = $rt['floor'];
}
return $robFloors;
}
示例10: getsByCreateTime
function getsByCreateTime($groupIds, $createTime)
{
if (!is_array($groupIds)) {
return false;
}
$query = $this->_db->query("SELECT * FROM " . $this->_tableName . " WHERE created_time > " . $this->_addSlashes($createTime) . " AND oid in(" . S::sqlImplode($groupIds) . ")");
return $this->_getAllResultFromQuery($query);
}
示例11: getsByPostIds
function getsByPostIds($postIds, $table)
{
if (!$table) {
return false;
}
$postIds = is_array($postIds) ? S::sqlImplode($postIds) : $postIds;
$query = $this->_db->query("SELECT * FROM " . $table . " p WHERE p.pid in(" . $postIds . ") ORDER BY p.postdate DESC");
return $this->_getAllResultFromQuery($query);
}
示例12: _buildCondition
/**
*
* 组装搜索条件
* @param array $modelid 分类信息id
* @param string $fid 版块id
* @return string
*/
function _buildCondition($modelid, $fid)
{
$sqlWhere = ' WHERE modelid != 0';
!empty($modelid) && ($sqlWhere .= ' AND modelid IN (' . S::sqlImplode($modelid) . ')');
$fid && ($sqlWhere .= ' AND fid IN (' . $fid . ')');
$blackListedTids = $this->_getBlackListedTids();
$blackListedTids && ($sqlWhere .= ' AND tid NOT IN (' . $blackListedTids . ')');
return $sqlWhere;
}
示例13: getsByDids
function getsByDids($dids)
{
if (!$dids) {
return false;
}
$dids = is_array($dids) ? S::sqlImplode($dids) : $dids;
$query = $this->_db->query("SELECT * FROM " . $this->_tableName . " WHERE did in(" . $dids . ") ORDER BY postdate DESC ");
return $this->_getAllResultFromQuery($query);
}
示例14: deleteByUids
function deleteByUids($tid, $pid, $uids)
{
$tid = intval($tid);
$pid = intval($pid);
if (!$tid || !S::isArray($uids)) {
return false;
}
return $this->_db->update("DELETE FROM {$this->_tableName} WHERE tid={$tid} AND pid={$pid} AND uid IN( " . S::sqlImplode($uids) . ')');
}
示例15: getData
/**
* 按照分类、是否有logo查找链接信息
*
* @param int $num 条数
* @param bool false 是否有logo
* @param array $sids 链接ID数组
* @return array 友情链接分类信息
*/
function getData($num, $sids, $haveLogo = false)
{
$num = (int) $num;
$num && ($limit = $this->_Limit(0, $num));
$haveLogo && ($_sqlAdd = " AND logo <> '' ");
is_array($sids) && ($_sqlsids = " AND sid IN(" . S::sqlImplode($sids) . ")");
$query = $this->_db->query("SELECT * FROM {$this->_tableName} WHERE ifcheck = '1' " . $_sqlsids . $_sqlAdd . " ORDER BY threadorder ASC {$limit}");
return $this->_getAllResultFromQuery($query);
}