本文整理汇总了PHP中Record::countFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::countFrom方法的具体用法?PHP Record::countFrom怎么用?PHP Record::countFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::countFrom方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_album
public function view_album()
{
$this->_checkPermission();
$paths = func_get_args();
$id = urldecode(join('/', $paths));
$albums = Record::query('select * from ' . TABLE_PREFIX . 'album where id="' . $id . '"');
$album = $albums->fetchObject();
/* Pagination */
if (isset($_GET['page'])) {
$CurPage = $_GET['page'];
} else {
$CurPage = 0;
}
$rowspage = 20;
$start = $CurPage * $rowspage;
$totalrecords = Record::countFrom('Gallery', 'album_id="' . $id . '"');
$galleries = Record::query('select * from ' . TABLE_PREFIX . 'gallery g where g.album_id = "' . $id . '" ORDER BY g.sequence LIMIT ' . $start . ',' . $rowspage);
$lastpage = ceil($totalrecords / $rowspage);
if ($totalrecords <= $rowspage) {
$lastpage = 0;
} else {
$lastpage = abs($lastpage - 1);
}
/* End Pagination */
$this->display('gallery/view_album', array('album' => $album, 'CurPage' => $CurPage, 'lastpage' => $lastpage, 'galleries' => $galleries, 'pages' => Record::findAllFrom('Page', 'parent_id=1 order by parent_id,position')));
}
示例2: isUsed
public function isUsed()
{
/* TODO: This should use Page::count() */
return Record::countFrom('Page', 'layout_id=?', array($this->id));
}
示例3: isUsed
public function isUsed()
{
return Record::countFrom('Page', 'layout_id = :layout_id', array(':layout_id' => $this->id));
}
示例4: addslashes
case "employee_login":
$success = false;
$login_nric = addslashes($_POST['login_nric']);
$login_password = addslashes($_POST['login_password']);
$encrypt_password = md5($login_password);
if (empty($login_nric)) {
$error = "nonric";
// } else if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $login_nric)){
// $error = "invalidemail";
} else {
if (empty($login_password)) {
$error = "nopass";
} else {
$employee = new Employee();
$valid_employee = $employee->findOneFrom('Employee', 'NRIC = "' . $login_nric . '" AND password="' . $encrypt_password . '"');
if (Record::countFrom('Employee', 'NRIC = "' . $login_nric . '" AND password="' . $encrypt_password . '"') > 0) {
$employee = $valid_employee;
$today = date("Y-m-d");
$expire = $employee->validate_date;
$today_time = strtotime($today);
$expire_time = strtotime($expire);
if ($employee->suspended) {
$error = "suspended";
} else {
if (!$employee->validate) {
$error = "notvalidate";
} else {
if ($expire_time < $today_time) {
$error = "expired";
} else {
$value = $employee->employee_id;
示例5: Employee
<?php
$employee_id = $_COOKIE['cookie_employee_id'];
if ($employee_id != "") {
$oEmployee = new Employee();
$employee = $oEmployee->findOneFrom("Employee", "employee_id=" . $employee_id);
}
if (isset($_POST['pageaction'])) {
if ($_POST['pageaction'] == 'updateprofile') {
$email = $_POST['email'];
$mobiletel = $_POST['mobiletel'];
$email_count = Record::countFrom("Employee", "email='" . addslashes($email) . "' AND employee_id<>'" . $employee_id . "'");
if ($email_count == 0) {
Record::query('UPDATE ' . TABLE_PREFIX . 'employee set email = "' . addslashes($email) . '",mobiletel = "' . addslashes($mobiletel) . '" where employee_id="' . $employee_id . '"');
$status = "success";
} else {
$status = "failed";
$msg1 = 'Email Exists.';
}
redirect(get_url('employee/setting?status1=' . $status . '&msg1=' . $msg1));
}
if ($_POST['pageaction'] == 'changepass') {
if ($employee_id != "") {
if ($employee) {
$email = $employee->email;
$old_password = $employee->password;
$nric = $employee->NRIC;
}
}
$current_password = $_POST["current_password"];
$new_password = $_POST["new_password"];
示例6: downloadSearch
function downloadSearch($terms,$limit=10,$offset=0,$order='name',$expired=false,$inactive=false) {
$where = '1';
// show expired downloads?
if ($expired === false) $where .= " AND ( `downloads`.`expires` > NOW() || `downloads`.`expires` IS NULL )";
// show inactive downloads?
if ($inactive === false) $where .= " AND `downloads`.`active` = '1'";
$order = strtolower($order);
$order = in_array($order,explode(',','id,name,filename,active,downloads,expires,created,updated')) && !empty($order) ? $order : 'name' ;
$order = $order == 'downloads' ? 'downloads.'.$order.' DESC' : 'downloads.'.$order.' ASC';
if (! empty($terms)) {
$querys = preg_replace('/[^a-z0-9 %]/i',' ',$terms);
$querys = strstr($querys,' ') !== false ? explode(' ',$querys) : array($querys);
$querys = preg_replace(array('/ing$/i','/ed$/i','/s$/i'),'',$querys);
foreach ($querys as $query) {
if (strstr($query,'%') === false && !empty($query)) $query = "%{$query}%";
if (!empty($query)) $where .= " AND ( downloads.name LIKE ".Record::escape($query)." OR downloads.description LIKE ".Record::escape($query)." OR downloads.keywords LIKE ".Record::escape($query)." ) ";
}
}
if (!$results = Download::findAll(array('where'=>$where,'limit'=>$limit,'offset'=>$offset,'order'=>$order))) return false;
$count = Record::countFrom('Download',$where);
return array('downloads'=>$results,'count'=>$count);
}