本文整理汇总了PHP中get_count函数的典型用法代码示例。如果您正苦于以下问题:PHP get_count函数的具体用法?PHP get_count怎么用?PHP get_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_count函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: count
static function count($force = false)
{
global $db;
$count = get_count('posts');
if ($count === false || $force) {
$count = $db->get_var("select count(*) from posts");
set_count('posts', $count);
}
return $count;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:10,代码来源:post.php
示例2: index
function index($page = NULL)
{
check_admin();
$data = array();
$limit = 10;
$page = intval($page) > 0 ? $page : 1;
$start = ($page - 1) * $limit;
$data['froms'] = $this->form->get_forms($start, $limit);
$page_all = ceil(get_count() / $limit);
$data['pager'] = get_pager($page, $page_all, '/design');
$this->view('index', $data);
}
开发者ID:yunsite,项目名称:easysns,代码行数:12,代码来源:design.php
示例3: index
function index()
{
//$data = array();
$data['ci_top_title'] = '微件列表';
$args = func_get_args();
if (isset($args[2])) {
$search = strip_tags(trim($args[2]));
$search = urldecode($search);
} else {
$search = strip_tags(trim(v('search')));
}
$data['search'] = $search;
$type = intval(v('type'));
if ($args) {
$mid = intval($args[0]);
}
if (!isset($mid) || $mid == '') {
$mid = $type;
}
//
if ($mid == '0') {
$where = " AND `name` LIKE '%" . $search . "%' ";
//$data['name'] = '全部范围';
} elseif ($mid > '0') {
$where = " AND `mid` = '" . intval($mid) . "' AND `name` LIKE '%" . $search . "%'";
$name = lazy_get_var("SELECT `name` FROM `u2_plugs` WHERE 1 AND `id` = '" . intval($mid) . "'");
if (!$name) {
info_page('错误的组件ID');
}
} else {
info_page('错误的组件ID');
}
$data['mid'] = $mid;
$data['plugs_name'] = lazy_get_data("SELECT * FROM `u2_plugs`");
$data['page'] = $page = !isset($args[1]) || intval($args[1]) < 1 ? 1 : intval($args[1]);
$limit = 5;
$start = ($page - 1) * $limit;
$item = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs_widget` WHERE 1 {$where} ORDER BY `id` DESC LIMIT {$start},{$limit}");
$all = get_count();
$data['item'] = $item;
//$type = urlencode( $type );
$base = '/plugs/index/' . $mid;
$page_all = ceil($all / $limit);
$text = urlencode($search);
$data['pager'] = get_pager($page, $page_all, $base, $text);
$data['is_admin'] = is_admin() ? true : false;
$domain = _sess('domain');
if ($domain != '') {
$data['domain'] = $domain;
}
$this->view('list', $data);
}
开发者ID:yunsite,项目名称:easysns,代码行数:52,代码来源:plugs.php
示例4: count
static function count($status = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $force) + Link::count('queued', $force) + Link::count('discard', $force) + Link::count('abuse', $force) + Link::count('autodiscard', $force);
}
$count = get_count("{$my_id}.{$status}");
if ($count === false || $force) {
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}'");
set_count("{$my_id}.{$status}", $count);
}
return $count;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:14,代码来源:link.php
示例5: add
function add($mas)
{
global $mysqli;
$query = $mysqli->query("Select id_group from tb_group WHERE name_doup='" . $mas[2] . "';");
$id = '';
while ($row = $query->fetch_assoc()) {
$id = $row["id_group"];
}
if ($id == '') {
$mysqli->query("insert into tb_group set name_doup='" . $mas[2] . "';");
$id = $mysqli->insert_id;
}
echo get_count($query) . ' ' . $id . '<br>';
$query = $mysqli->query("INSERT into tb_items set id_items='" . $mas[0] . "', id_cat='" . $id . "', price='" . $mas[8] . "', name='" . $mas[4] . "', disrc='" . $mas[9] . "',full_disr='" . $mas[9] . "';");
}
开发者ID:arhipos,项目名称:Arbel,代码行数:15,代码来源:parser.php
示例6: count
static function count($status = '', $cat = '', $force = false)
{
global $db;
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$status}.{$cat}");
if ($count === false || $force) {
if ($cat) {
$cond = " and link_category in ({$cat}) ";
}
$count = $db->get_var("select count(*) from links where link_status = '{$status}' {$cond}");
set_count("{$status}.{$cat}", $count);
}
return $count;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:16,代码来源:link.php
示例7: count
static function count($status='', $cat='', $force = false) {
global $db;
if (!$status) return Link::count('published', $cat, $force) +
Link::count('queued', $cat, $force) +
Link::count('discard', $cat, $force) +
Link::count('abuse', $cat, $force) +
Link::count('autodiscard', $cat, $force);
$count = get_count("$status.$cat");
if ($count === false || $force) {
if ($cat) $cond = " and link_category in ($cat) ";
$count = $db->get_var("select count(*) from links where link_status = '$status' $cond");
set_count("$status.$cat", $count);
}
return $count;
}
开发者ID:rasomu,项目名称:chuza,代码行数:18,代码来源:link.php
示例8: count
static function count($status = '', $cat = '', $force = false)
{
global $db, $globals;
$my_id = SitesMgr::my_id();
if (!$status) {
return Link::count('published', $cat, $force) + Link::count('queued', $cat, $force) + Link::count('discard', $cat, $force) + Link::count('abuse', $cat, $force) + Link::count('autodiscard', $cat, $force);
}
$count = get_count("{$my_id}.{$status}.{$cat}");
if ($count === false || $force) {
if (!empty($cat)) {
$extra = "and category in ({$cat})";
} else {
$extra = '';
}
$count = $db->get_var("select count(*) from sub_statuses where id = {$my_id} and status = '{$status}' {$extra}");
set_count("{$my_id}.{$status}.{$cat}", $count);
}
return $count;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:19,代码来源:link.php
示例9: get_test_one
/**
* 获取一道测试题目和题目选项
*
* @param integer $offset;
* return array;
*/
function get_test_one($offset)
{
$tc_id = get_tcid($offset);
$count = get_count($tc_id);
$num = get_total($tc_id);
$sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question WHERE `tc_id`='{$tc_id}' \n\t\tLIMIT {$num},1";
echo $sql, '<br>';
$question = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
$sql = "SELECT * FROM {$GLOBALS['dbTablePre']}test_question_option WHERE `qid`='{$question['qid']}'";
//echo $sql,'<br>';
$option = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
$temp = array();
$temp['tc_id'] = $tc_id;
$temp['count'] = $count;
$temp['num'] = $num;
$temp['question'] = $question;
$temp['option'] = $option;
return $temp;
}
开发者ID:noikiy,项目名称:zays,代码行数:25,代码来源:function.php
示例10: get_system_plugs_data
function get_system_plugs_data($para = NULL)
{
$para = unserialize($para);
$page = 1;
if (isset($para['args'])) {
$page = intval(array_shift($para['args']));
}
$page = $page < 1 ? 1 : $page;
$data['title'] = isset($para['title']) && strip_tags($para['title']) != '' ? strip_tags($para['title']) : '组件';
$limit = isset($para['limit']) && intval($para['limit']) > 0 ? intval($para['limit']) : 5;
$start = ($page - 1) * $limit;
$data['lines'] = 4;
$apps = lazy_get_data("SELECT sql_calc_found_rows * FROM `u2_plugs` WHERE `is_active` = 1 ORDER BY `has_widget` DESC LIMIT {$start},{$limit} ");
$all = get_count();
$wid = intval($GLOBALS['widget_id']);
$page_all = ceil($all / $limit);
$data['pager'] = get_widget_pager($wid, $page, $page_all);
if ($apps) {
foreach ($apps as $k => $v) {
$aids[$v['aid']] = $v['aid'];
$uids[$v['uid']] = $v['uid'];
}
if ($uids) {
$data['names'] = get_name_by_uids($uids);
}
$data['aids'] = $aids;
$data['apps'] = $apps;
}
$wids = lazy_get_data("SELECT * FROM `u2_plugs_widget`");
if ($wids) {
$data['wids'] = $wids;
}
$domain = _sess('domain');
if ($domain != '') {
$data['domain'] = $domain;
}
if (is_login()) {
$data['is_login'] = true;
}
return $data;
}
开发者ID:yunsite,项目名称:easysns,代码行数:41,代码来源:code.php
示例11: sizeof
$flow_cnt = sizeof($flow_arr);
if ($flow_cnt > 0) {
for ($c = 0; $c < $flow_cnt; $c++) {
if ($flow_arr[$c] == $login_id) {
$flow_no = $c + 1;
break;
}
}
}
$view = false;
$recognize_sign = get_first("workflow_ret", "recognize_sign", "refno=" . $row["seqno"] . " AND seqno=" . $flow_no, "");
if ($recognize_sign == "") {
if ($flow_no == 1) {
$view = true;
} else {
$before_res_cnt = get_count("workflow_ret", "refno=" . $row["seqno"] . " AND seqno=" . ($flow_no - 1));
if ($before_res_cnt > 0) {
$view = true;
}
}
}
if ($view) {
$v++;
print "<TR>";
// メモ内容
print "<TD VALIGN=TOP>";
print "・<A HREF=\"./workflow/result/?p=top&no=" . $row["seqno"] . "\">";
$subject = mb_strcut($row["subject"], 0, 60, "EUC-JP");
if (trim($subject) == "") {
$subject = "(no subject)";
}
开发者ID:batatch,项目名称:PenguinOffice,代码行数:31,代码来源:part_workflow.php
示例12: info_page
if (!is_login()) {
info_page('请登录后查看');
}
include_once dirname(__FILE__) . '/function.php';
$data = array();
$tab_type = 'items';
$data['ci_top_title'] = '物品';
$data['tab_type'] = $tab_type;
$data['tab_array'] = $tab_array;
$page = array_shift($args);
$page = intval($page) < 1 ? 1 : intval($page);
$limit = '48';
$start = ($page - 1) * $limit;
$uid = format_uid();
$items = lazy_get_data("select sql_calc_found_rows * from `global_user_items` where `uid` = '{$uid}' and `count` > 0 LIMIT {$start} , {$limit} ");
$all = get_count();
$base = '/app/native/ihome/items';
$page_all = ceil($all / $limit);
$data['pager'] = get_pager($page, $page_all, $base);
$data['list'] = array();
if ($items) {
foreach ($items as $v) {
$iid[] = $v['iid'];
$count[$v['iid']] = $v['count'];
}
$items_info = lazy_get_data("select * from `global_items` where `id` IN(" . join(',', $iid) . ") ");
if ($items_info) {
foreach ($items_info as $v) {
$v['count'] = $count[$v['id']];
$data['list'][] = $v;
}
开发者ID:yunsite,项目名称:easysns,代码行数:31,代码来源:items.php
示例13: exit
echo "clients_disabled.draw LINE2\n";
exit(0);
}
$db = Db::GetDatabaseHandle($baseParams, 'ykval-munin-yubikeystats');
if (!$db->connect()) {
logdie($myLog, 'ERROR Database connect error (1)');
}
function get_count($db, $table, $conditions)
{
$res = $db->customQuery("SELECT count(1) as count FROM {$table} WHERE {$conditions}");
if ($res) {
$r = $res->fetch(PDO::FETCH_ASSOC);
return $r['count'];
}
return Null;
}
if ($count = get_count($db, 'yubikeys', 'active=true')) {
echo "yubikeys_enabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'active=false')) {
echo "yubikeys_disabled.value {$count}\n";
}
if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - 31 * 86400))) {
echo "yubikeys_1month.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=true')) {
echo "clients_enabled.value {$count}\n";
}
if ($count = get_count($db, 'clients', 'active=false')) {
echo "clients_disabled.value {$count}\n";
}
开发者ID:paulmenzel,项目名称:yubikey-val,代码行数:31,代码来源:ykval-munin-yubikeystats.php
示例14: not_found
if (empty($posts) || $page < 1) {
// a non-existing page
not_found();
}
render('main', array('title' => 'Posts tagged: ' . tag_i18n($tag) . ' - ' . blog_title(), 'description' => 'All posts tagged: ' . tag_i18n($tag) . ' on ' . blog_title() . '.', 'canonical' => site_url() . 'tag/' . strtolower($tag), 'page' => $page, 'posts' => $posts, 'tag' => $ttag, 'bodyclass' => 'intag', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Posts tagged: ' . tag_i18n($tag), 'pagination' => has_pagination($total, $perpage, $page), 'is_tag' => true));
});
// Show the archive page
get('/archive/:req', function ($req) {
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
$page = from($_GET, 'page');
$page = $page ? (int) $page : 1;
$perpage = config('archive.perpage');
$posts = get_archive($req, $page, $perpage);
$total = get_count($req, 'basename');
if (empty($posts) || $page < 1) {
// a non-existing page
not_found();
}
$time = explode('-', $req);
$date = strtotime($req);
if (isset($time[0]) && isset($time[1]) && isset($time[2])) {
$timestamp = date('d F Y', $date);
} elseif (isset($time[0]) && isset($time[1])) {
$timestamp = date('F Y', $date);
} else {
$timestamp = $req;
}
$tarchive = new stdClass();
$tarchive->title = $timestamp;
开发者ID:robihidayat,项目名称:htmly,代码行数:31,代码来源:htmly.php
示例15: stripslashes
$word = stripslashes($word);
}
$word = trim(strip_tags($word));
if (strlen($word) < 2) {
$warn_str = "请输入正确的词汇";
} else {
if (strlen($word) > 30) {
$warn_str = "输入的词语太长了";
} else {
if (strpos($word, ' ') !== false) {
$warn_str = "词汇不要包含空格";
} else {
if (preg_match('/[\\x81-\\xfe]/', $word) && preg_match('/[\\x20-\\x7f]{3}/', $word)) {
$warn_str = "中英混合时字母最多只能出3个以下的连续字母";
} else {
$count = get_count($word);
if ($count < 0) {
$warn_str = "内部原因,计算失败!";
} else {
$res = get_tfidf($word, $count);
}
}
}
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新词生词的TF/IDF计算器 - for scws</title>
开发者ID:bearlin,项目名称:scws,代码行数:31,代码来源:get_tfidf.php
示例16: _e
_e('Mass Spam Nuke');
?>
</h2>
<?php
_e('<p>Mass Spam Nuke allows you to delete every comment in your database that is flagged as spam with one click. Be warned this is undoable, if you are sure you don\'t have some legitimate comments flagged as spam then go for it.</p>');
function get_count()
{
global $wpdb, $comments;
$comments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_approved = 'spam'");
echo $comments;
}
?>
<form method="post" action="admin.php?page=cjd_delete.php&action=nuked" name="form1">
<input type="hidden" name="action" value="nuked" />
There are currently <?php
get_count();
?>
comments identified as spam. <input type="submit" name="Submit" value="Nuke em, nuke em all!">
</form>
</div>
<div class="wrap">
<h2><?php
_e('Selective Spam Nuke');
?>
</h2>
<?php
_e('<p>Selective Spam Nuke allows you to choose the spam you are nuking by clicking the checkbox at the beginning of each row. When you have checked all the spam you want for deletion simply click the Nuke em! button at the bottom of the screen and that\'s it.</p>');
$comments = $wpdb->get_results("SELECT *, COUNT(*) AS count FROM {$wpdb->comments} WHERE comment_approved = 'spam' GROUP BY comment_author_IP");
if ($comments) {
?>
<table width="100%" cellpadding="3" cellspacing="3">
开发者ID:raidenz,项目名称:CJD-Spam-Nuke,代码行数:31,代码来源:cjd_delete.php
示例17: number_format
$menutext .= "<IMG SRC=\"{$toppath}/image/tri.gif\" WIDTH=12 HEIGHT=13>";
}
$menutext .= "</TD><TD>";
if ($adr_kind != $kind_key) {
$menutext .= "<A HREF=\"{$toppath}/address/?new_kind={$kind_key}\">";
}
$menutext .= $kind_name;
$menutext .= "</A>";
if ($count > 0) {
$menutext .= " (" . number_format($count) . ")";
}
$menutext .= "</TD></TR>\n";
}
}
$menutext .= "<TR><TD HEIGHT=1 COLSPAN=2 BGCOLOR=#999999></TD></TR>";
$menutext .= "<TR><TD WIDTH=16>";
if ($adr_kind == "kindisnone") {
$menutext .= "<IMG SRC=\"{$toppath}/image/tri.gif\" WIDTH=12 HEIGHT=13>";
} else {
$menutext .= " ";
}
$menutext .= "</TD><TD>";
if ($adr_kind == "kindisnone") {
$menutext .= "分類未設定";
} else {
$menutext .= "<A HREF=\"{$toppath}/address/?new_kind=kindisnone\">分類未設定";
}
$menutext .= " (" . number_format(get_count("address", "kind_list='' or kind_list is null")) . ")";
$menutext .= "</TD></TR>";
$menutext .= "</TABLE>\n";
$menutext .= "</TD></TR>\n</TABLE>\n</TD></TR></TABLE>\n\n<BR>\n";
开发者ID:batatch,项目名称:PenguinOffice,代码行数:31,代码来源:menu.inc.php
示例18: get_posts
/**
* Obtiene los posts de cada Blog, si el $id_users
* es cero, entonces son de la pagina principal.
*
* @param int $id_posts
* @param int $id_users
* @param int $start
* @return array
*/
function get_posts($id_posts = 0, $id_users = 0, $start = 0, $active = 'yes')
{
global $db;
global $preferences;
global $_GET;
$where = '';
$where .= $active != 'all' ? ' posts.active = \'' . $active . '\'' : ' 1';
$where .= $id_posts > 0 ? ' AND posts.id_posts = ' . $id_posts : '';
$where .= $id_users > 0 ? ' AND posts.id_users = ' . $id_users : '';
$q = new Query($db);
$q->exec('SELECT posts.id_posts
, posts.id_users
, posts.title
, posts.content
, posts.date
, posts.modified
, posts.active
, users.name AS user
, users.username
FROM posts
LEFT JOIN users ON ( users.id_users = posts.id_users )
WHERE
' . $where . '
ORDER BY posts.date DESC
LIMIT ' . $start . ', ' . $preferences['per_page']);
$data = array();
$posts = '';
$pagination = '';
$comments = '';
for ($i = 0; $i < $q->numrows; $i++) {
$data[$q->data['id_posts']] = $q->data;
$posts .= '
<h1><a href="?id_posts=' . $q->data['id_posts'] . '">' . $q->data['title'] . '</a></h1>
' . ($q->data['id_users'] > 0 ? '<a href="?id_users=' . $q->data['id_users'] . '">' . $q->data['user'] . '</a>' : 'Anonymous') . ' writes ' . $q->data['content'] . '
<div class="article_menu">
<b>Posted on ' . date($preferences['date_format'], strtotime($q->data['date'])) . '</b> <a href="?id_posts=' . $q->data['id_posts'] . '">' . get_count('comments', 'id_posts = ' . $q->data['id_posts']) . ' Comments</a>
</div>';
$q->nxt();
}
$q->free();
if ($id_posts < 1) {
foreach ($_GET as $key => $value) {
if ($key != 'start') {
$php_self .= (strpos($php_self, '?') !== false ? '&' : '?') . $key . '=' . $value;
}
}
$pagination = generate_pagination($php_self, get_count('posts', $id_users > 0 ? 'id_users = ' . $id_users : ''), $preferences['per_page'], $start);
}
if ($id_posts > 0) {
list($comments_data, $comments) = get_comments($id_posts);
}
return array($data, $posts, $pagination, $comments);
}
开发者ID:joksnet,项目名称:php-old,代码行数:62,代码来源:functions.php
示例19: strtolower
if ($action == NULL) {
$action = strtolower(filter_input(INPUT_GET, 'action'));
if ($action == NULL) {
$action = 'list_selected_tests';
}
}
verify_logged_in();
if (isset($action) and $action == "logout") {
if (isset($_SESSION['prev_usr_id'])) {
$_SESSION['user'] = User::getUserByUsrId($_SESSION['prev_usr_id']);
unset($_SESSION['prev_usr_id']);
header("Location: ../admin/index.php");
} else {
session_destroy();
header("Location: ../index.php");
}
}
switch ($action) {
case 'list_selected_tests':
$count = get_count($user->usr_id);
$testSelectedList = get_selected_test_list($user->usr_id);
include './view.php';
break;
case 'show_itinerary':
header("Location: ../itinerary");
break;
default:
echo 'Unknown account action: ' . $action;
break;
}
exit;
开发者ID:ATCS-BCA,项目名称:bca-apps,代码行数:31,代码来源:index.php
示例20: is_empty
function is_empty($sq)
{
return get_count($sq) === 0;
}
开发者ID:sergigp,项目名称:funiculus,代码行数:4,代码来源:funiculus.php
注:本文中的get_count函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论