本文整理汇总了PHP中COUNT函数的典型用法代码示例。如果您正苦于以下问题:PHP COUNT函数的具体用法?PHP COUNT怎么用?PHP COUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COUNT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// set rules
$this->_set_page_rule('R');
// set template content
$this->smarty->assign("template_content", "member/pending/index.html");
// list waiting
$rs_id = $this->m_member->get_list_pending_task_waiting(array($this->com_user['role_id'], $this->com_user['airlines_id']));
foreach ($rs_id as $value) {
// get detail rute
$rs_rute = $this->m_member->get_data_rute_by_id(array($value['data_id']));
$total_rute = COUNT($rs_rute);
$list_rute = "";
$x = 1;
foreach ($rs_rute as $rute) {
$x++;
$list_rute .= $rute['airport_iata_cd'];
if ($x <= $total_rute) {
$list_rute .= "-";
}
}
$data[] = array("data_id" => $value['data_id'], "document_no" => $value['document_no'], "data_type" => $value['data_type'], "data_flight" => $value['data_flight'], "date_start" => $value['date_start'], "date_end" => $value['date_end'], "rute_all" => $list_rute, "services_nm" => $value['services_nm'], "task_nm" => $value['task_nm'], "selisih_hari" => $value['selisih_hari'], "selisih_waktu" => $value['selisih_waktu'], "group_link" => $value['group_link']);
}
$this->smarty->assign("rs_id", $rs_id);
// $this->smarty->assign("rs_id", $rs_id);
$this->smarty->assign("total", count($rs_id));
// notification
$this->tnotification->display_notification();
$this->tnotification->display_last_field();
// output
parent::display();
}
示例2: index
public function index()
{
// 取商铺幻灯片
$where = array('type' => 'SHOP');
$scroll_shop = M('scroll')->where($where)->order('sort')->select();
while (COUNT($scroll_shop) < 12) {
$scroll_shop = array_merge($scroll_shop, $scroll_shop);
}
$this->scroll_shop = $scroll_shop;
// 取首页幻灯片
$where = array('type' => 'INDEX');
$this->scroll_index = M('scroll')->where($where)->order('sort')->select();
// 男士服装封面图片
$data = M('picture')->where(array('type' => 'MANCLOTH'))->find();
$this->man_cloth_picture = $data['pic_adr'];
// 女士服装封面图片
$data = M('picture')->where(array('type' => 'WOMANCLOTH'))->find();
$this->woman_cloth_picture = $data['pic_adr'];
// 鞋类封面图片
$data = M('picture')->where(array('type' => 'SHOE'))->find();
$this->shoe_picture = $data['pic_adr'];
// 取QQ
$where = array('type' => 'QQ');
$this->QQ = M('webinfo')->where($where)->find();
$this->display();
}
示例3: indexAction
public function indexAction()
{
$loansearch = new Loandisbursmentg_Form_Search();
$this->view->form = $loansearch;
$this->view->transactiontype = 'Loan transaction';
if ($this->_request->isPost() && $this->_request->getPost('Search')) {
$formData = $this->_request->getPost();
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($loansearch->isValid($formData)) {
$search = $this->view->loanModel->searchaccounts($this->_request->getParam('accNum'));
if (!$search) {
echo "Enter a valid Number";
} else {
if (COUNT($search) == '1') {
foreach ($search as $account) {
$accountnumber = $account->number;
}
$this->_redirect("/loandisbursmentg/index/disbursment/accNum/" . base64_encode($accountnumber));
} else {
$this->view->accounts = $search;
}
}
}
}
}
}
示例4: postBuscardni
public function postBuscardni()
{
if (Request::ajax()) {
$dni = Input::get('dni');
$ficha = Input::get('ficha');
$aData = Reniec::getPersona($dni);
$aParametro['data'] = $aData;
$aParametro['rst'] = 1;
$aParametro['msj'] = "";
if (COUNT($aData) == 0) {
$ef = EscalafonFichas::getEFIdporFicha($ficha);
$efr = EscalafonFichas::getEFRIdporFicha($ficha);
$ficham = new Ficha();
if (count($ef) > 0) {
$ficham['escalafon_ficha_id'] = $ef[0]->id;
if (count($efr) > 0) {
$ficham['escalafon_ficha_recepcion_id'] = $efr[0]->id;
}
}
$ficham['ficha'] = $ficha;
$ficham['estado_ficha'] = 3;
$ficham['usuario_created_at'] = Auth::user()->id;
$ficham->save();
$aParametro['rst'] = 2;
$aParametro['msj'] = "No Existe persona con el dni:" . $dni . " Será contabilizada como firma inválida";
}
$vef = Ficha::getValidarEstadoFicha($ficha);
$aParametro['estado'] = $vef;
return Response::json($aParametro);
}
}
示例5: DataTable
public static function DataTable($db_name, $array_data)
{
$list = "<a href='?T=" . $_GET["T"] . "&REQ=DEL_TABLE'>- DELETE TABLE " . strtoupper($_GET["T"]) . "</a><br>";
$list .= "<a href='?T=" . $_GET["T"] . "&REQ=ADD_ENTITIES'>- ADD ENTITIES TO " . strtoupper($_GET["T"]) . "</a><br>";
$list .= "<table>";
//open table
$i = 0;
//iteraction counter
$a = 0;
//get table name
foreach ($array_data[0] as $key => $value) {
if ($i % 2 == 0) {
$list .= "<th>" . $key . "</th>";
$titre[$a] = $key;
$a++;
}
$i++;
}
//get table data
foreach ($array_data as $k => $DATA) {
$list .= "<tr>";
//open row
for ($i = 0; $i < COUNT($DATA) / 2; $i++) {
$list .= "<td>" . $DATA[$i] . "</td>";
}
$list .= "<td><a href='?ID=" . $DATA[0] . "&PRIMARY=" . $titre[0] . "&T=" . $_GET["T"] . "&REQ=UPDATE_DATA'><img src='./Fichiers/images/modifier.png'></a></td>";
$list .= "<td><a href='?ID=" . $DATA[0] . "&PRIMARY=" . $titre[0] . "&T=" . $_GET["T"] . "&REQ=DEL_DATA'><img src='./Fichiers/images/supprimer.png'></a></td>";
$list .= "</tr>";
// close row
}
$list .= "</table>";
//close table
return $list;
}
示例6: search_func
public function search_func()
{
$make = $this->input->post("chosen_make_box");
echo json_encode($make);
die;
$make = "";
$year = "";
$price = "";
if (isset($_POST['chosen_make_box'])) {
$make = $_POST['chosen_make_box'];
}
if ($_POST['chosen_year_box']) {
$year = $_POST['chosen_year_box'];
}
if ($_POST['chosen_price_tag']) {
$price = $_POST['chosen_price_tag'];
}
echo "<pre>";
print_r($_POST);
die;
$data["result"] = $this->home_m->search_func($make, $year, $price);
$data['rows'] = COUNT($this->home_m->search_func($make, $year, $price));
$data['page_rows'] = 12;
$data['last'] = ceil($data['rows'] / $data['page_rows']);
$data['pagenum'] = 1;
//first page of gallery
print_r($data["result"]);
die;
$data['content_view'] = "index/search_v";
$data['menu'] = "home";
$this->load->view('template/layout', $data);
// echo json_encode($result);
}
示例7: index
public function index()
{
// set page rules
$this->_set_page_rule("R");
// set template content
$this->smarty->assign("template_content", "member/registration_non/list.html");
// list opened form
$rs_id = $this->m_registration->get_list_registration_open(array('bukan niaga', $this->com_user['airlines_id']));
$data = array();
foreach ($rs_id as $value) {
// get detail rute
$rs_rute = $this->m_registration->get_data_rute_by_id(array($value['data_id']));
$total_rute = COUNT($rs_rute);
$list_rute = "";
$x = 1;
foreach ($rs_rute as $rute) {
$x++;
$list_rute .= $rute['airport_iata_cd'];
if ($x <= $total_rute) {
$list_rute .= "-";
}
}
$data[] = array("data_id" => $value['data_id'], "published_no" => $value['published_no'], "data_type" => $value['data_type'], "data_flight" => $value['data_flight'], "date_start" => $value['date_start'], "date_end" => $value['date_end'], "rute_all" => $list_rute, "services_nm" => $value['services_nm'], "flight_no" => $value['flight_no'], "selisih_hari" => $value['selisih_hari'], "selisih_waktu" => $value['selisih_waktu']);
}
$this->smarty->assign("rs_id", $rs_id);
$this->smarty->assign("total", count($rs_id));
// notification
$this->tnotification->display_notification();
$this->tnotification->display_last_field();
// output
parent::display();
}
示例8: index
public function index()
{
// 基础信息
$phone = M('webinfo')->where(array('type' => C('电话')))->field('content')->find();
$middle = explode(' ', $phone['content']);
$this->phone = $middle['0'];
$banquan = M('webinfo')->where(array('type' => C('版权')))->field('content')->find();
$this->banquan = $banquan['content'];
// 明星师资
$teacher = M('teacher')->order('sort')->field('controller,created_time,sort', ture)->select();
for ($i = 0; $i < COUNT($teacher); $i++) {
$teacher[$i]['content'] = mb_substr($teacher[$i]['content'], 0, 78, 'utf-8');
$teacher[$i]['content'] = $teacher[$i]['content'] . "...";
}
$this->teacher = $teacher;
// 历届成绩
$achievement = M('achievement')->order('sort')->field('controller,created_time,sort', ture)->select();
// 遍历取录入情况
for ($i = 0; $i < COUNT($achievement); $i++) {
$str = "";
$data = M('achievement_status')->where(array('achievement_id' => $achievement[$i]['id']))->field('achievement_id', ture)->select();
for ($j = 0; $j < COUNT($data); $j++) {
$str = $str . $data[$j]['school'] . $data[$j]['number'] . '人;';
}
$achievement[$i]['status'] = $str;
}
$this->achievement = $achievement;
// 1977作品
$this->works = M('picture')->where(array('type' => C('作品展示')))->field('controller,created_time,type', ture)->find();
// 教学环境
$this->environment = M('picture')->where(array('type' => C('教学环境')))->field('controller,created_time,type', ture)->find();
$this->display();
}
示例9: track
public static function track($file, $rs = '')
{
$db = Database::getDatabase();
if (SITE_CONFIG_STATS_ONLY_COUNT_UNIQUE == 'yes') {
// check whether the user has already visited today
$sql = "SELECT * FROM stats WHERE ip = " . $db->quote(self::getIP()) . " AND page_title = " . $file->id . " AND DATE(dt) = " . $db->quote(date('Y-m-d'));
$row = $db->getRows($sql);
if (COUNT($row)) {
return false;
}
}
$file->updateVisitors();
$dt = date("Y-m-d H:i:s");
$referer = getenv('HTTP_REFERER');
$referer_is_local = self::refererIsLocal($referer);
$url = full_url();
$img_search = '';
$ip = self::getIP();
$info = self::browserInfo();
$browser_family = $info['browser'];
$browser_version = $info['version'];
$os = $info['platform'];
$os_version = '';
$user_agent = $info['useragent'];
$country = self::getCountry($ip);
$base_url = self::getBaseUrl($referer);
$sql = "INSERT INTO stats (dt, referer, referer_is_local, url, page_title, country, img_search, browser_family, browser_version, os, os_version, ip, user_agent, base_url)\n VALUES (:dt, :referer, :referer_is_local, :url, :page_title, :country, :img_search, :browser_family, :browser_version, :os, :os_version, :ip, :user_agent, :base_url)";
$vals = array('dt' => $dt, 'referer_is_local' => $referer_is_local, 'referer' => $referer, 'url' => $url, 'page_title' => $file->id, 'country' => $country, 'img_search' => $img_search, 'ip' => $ip, 'browser_family' => $browser_family, 'browser_version' => $browser_version, 'os_version' => $os_version, 'os' => $os, 'user_agent' => $user_agent, 'base_url' => $base_url);
$db->query($sql, $vals);
return true;
}
示例10: getQuestionsFromBD
public function getQuestionsFromBD()
{
$str = "";
$str .= "<center>";
$str .= "<table border = '1' id='hor-minimalist-b'><thead><tr><th scope='col'>Libelle</th><th scope='col'>Type</th><th scope='col'>Actions</th></tr></thead>";
$str .= "<tbody>";
for ($i = 0; $i < COUNT($this->mesQuestions); $i++) {
$str .= "<tr id = 'ligne'>";
$str .= "<td>" . $this->mesQuestions[$i]->getLibelle() . "</td>";
if ($this->mesQuestions[$i]->getType() == 0) {
$str .= "<td>OUVERTE</td>";
} else {
if ($this->mesQuestions[$i]->getType() == 1) {
$str .= "<td>FERMEE</td>";
} else {
$str .= "<td>NUMERIQUE</td>";
}
}
$str .= "<td><input type='button' id = 'suppr' value='SUPPRIMER' name='supprimer' onclick ='supprimerQuestion(" . $i . ");'/></td>";
$str .= "</tr>";
}
$str .= "</tbody>";
$str .= "</table>";
$str .= "</center>";
return $str;
}
示例11: getProduction
public function getProduction($type)
{
$classify_id = $_GET['classify'];
if ($classify_id == "" || $classify_id == 0 || $classify_id == null || $classify_id == 'all') {
// 条件
$where = array('type' => $type);
} else {
// 条件
$where = array('type' => $type, 'classify_id' => $classify_id);
}
// 获得当前页数
$pageNumber = $_GET['p'];
if ($pageNumber == "") {
$pageNumber = 0;
}
// 进行分页数据查询 注意page方法的参数的前面部分是当前的页数使用 $_GET[p]获取
$production = M('production')->where($where)->order('sort')->page($pageNumber, C('分页'))->select();
// 查询满足要求的总记录数
$count = M('production')->where($where)->count();
for ($i = 0; $i < COUNT($production); $i++) {
$rebate = $production[$i]['rebate'];
$production[$i]['deduction'] = $rebate / 100 * $production[$i]['price_now'];
}
$perPage = $count / C('分页');
// 数据映射
$this->production = $production;
$this->count = $count;
$this->perPage = $perPage;
$this->classify_id = $classify_id;
}
示例12: count_objects
function count_objects($value)
{
$cart = explode(',', $value);
if (is_null($value)) {
return '0';
}
return COUNT($cart);
}
示例13: load
/**
* Loads the entire menu table into memory.
*
* @return array
*/
public function load()
{
// Initialise variables.
$db = JFactory::getDbo();
$app = JApplication::getInstance('site');
$query = $db->getQuery(true);
$query->select('m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language');
$query->select('m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id');
$query->select('e.element as component');
$query->from('#__menu AS m');
$query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id');
$query->where('m.published = 1');
$query->where('m.parent_id > 0');
$query->where('m.client_id = 0');
$query->order('m.lft');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$where = null;
if (file_exists(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php') && file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ose_cpu'.DS.'define.php') && !file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_osemsc'.DS.'installer.dummy.ini'))
{
require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php');
$content_ids = oseRegistry::call('content')->getRestrictedContent('joomla','menu');
$where = (COUNT($content_ids) > 0)?$query->where(' m.id NOT IN ('.implode(',',$content_ids).')'):null;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Set the query
$db->setQuery($query);
if (!($this->_items = $db->loadObjectList('id'))) {
JError::raiseWarning(500, JText::sprintf('JERROR_LOADING_MENUS', $db->getErrorMsg()));
return false;
}
foreach($this->_items as &$item) {
// Get parent information.
$parent_tree = array();
if (isset($this->_items[$item->parent_id])) {
$parent_tree = $this->_items[$item->parent_id]->tree;
}
// Create tree.
$parent_tree[] = $item->id;
$item->tree = $parent_tree;
// Create the query array.
$url = str_replace('index.php?', '', $item->link);
$url = str_replace('&', '&', $url);
parse_str($url, $item->query);
}
}
示例14: bin2text
function bin2text($bin_str)
{
$text_str = '';
$chars = EXPLODE("\n", CHUNK_SPLIT(STR_REPLACE("\n", '', $bin_str), 8));
$_I = COUNT($chars);
for ($i = 0; $i < $_I; $text_str .= CHR(BINDEC($chars[$i])), $i) {
}
return $text_str;
}
示例15: checkUserFacebook
/**
* check user facebook in db
*/
public function checkUserFacebook($iFacebookUserId)
{
$iCount = (int) $this->database()->select(COUNT('*'))->from($this->_sTable)->where('fb_user_id = \'' . $this->database()->escape($iFacebookUserId) . '\'')->execute('getField');
if ($iCount > 0) {
return true;
} else {
return false;
}
}