本文整理汇总了PHP中where函数的典型用法代码示例。如果您正苦于以下问题:PHP where函数的具体用法?PHP where怎么用?PHP where使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了where函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_selected_record2
public function get_selected_record2($customer_id, $method)
{
$this->_db->where('customer_id', $customer_id);
$this->_db_ > where('payment_method', ".{$method}.");
$data = $this->_db->get(TBL_SUBSCRIPTION);
return $data;
}
示例2: index
public function index()
{
$offer = where('slug = %s', 'nieuwbouw')->get_row('offer/purpose');
echo view('head', array('title' => $offer && $offer->seo_title ? $offer->seo_title : 'Projecten', 'description' => $offer && $offer->seo_content ? $offer->seo_content : ''));
echo view('projects', array());
echo view('foot', array());
}
示例3: service
public function service($slug)
{
$service = where('slug = %s', $slug)->require_row('services/service');
echo view('head', array('title' => $service && $service->seo_title ? $service->seo_title : '', 'description' => $service && $service->seo_content ? $service->seo_content : ''));
echo view('service', array('service' => $service));
echo view('foot', array());
}
示例4: beforeAction
public function beforeAction($action)
{
$this->scanModules('payment');
$arrModules = Modules::model()->findAllByAttributes(array('category' => 'payment'), array('order' => 'module'));
$this->_allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']);
$menuSidebar = array();
foreach ($arrModules as $module) {
$currentModule = Yii::app()->getComponent($module->module);
if (is_null($currentModule)) {
continue;
}
if ($currentModule->cloudCompatible === false && _xls_get_conf('LIGHTSPEED_CLOUD') > 0) {
continue;
}
if ($currentModule->isDisplayable() === false) {
continue;
}
$menuSidebar[] = array('label' => $currentModule->AdminName, 'url' => array('payments/module', 'id' => $module->module), 'advancedPayment' => $currentModule->advancedMode);
}
$advancedPaymentMethods = where($menuSidebar, array('advancedPayment' => true));
$simplePaymentMethods = where($menuSidebar, array('advancedPayment' => false));
$this->menuItems = array_merge(array(array('label' => 'Simple Integration Modules', 'linkOptions' => array('class' => 'nav-header'))), $simplePaymentMethods, array(array('label' => 'Advanced Integration Modules', 'linkOptions' => array('class' => 'nav-header'), 'visible' => count($advancedPaymentMethods) > 0)), $advancedPaymentMethods, $this->getPaymentSetupLinks());
$objModules = Modules::model()->findAllByAttributes(array('category' => 'payment', 'active' => 1));
if (count($objModules) === 0 && $action->id == "index") {
$this->noneActive = 1;
Yii::app()->user->setFlash('error', Yii::t('admin', 'WARNING: You have no payment modules activated. No one can checkout.'));
}
return parent::beforeAction($action);
}
示例5: flat_load
/**
* Load entity
*
* @param array $entity
* @param array $crit
* @param array $opts
*
* @return array
*/
function flat_load(array $entity, array $crit = [], array $opts = []) : array
{
$stmt = db()->prepare(select($entity['attr']) . from($entity['tab']) . where($crit, $entity['attr'], $opts) . order($opts['order'] ?? [], $entity['attr']) . limit($opts['limit'] ?? 0, $opts['offset'] ?? 0));
$stmt->execute();
if (!empty($opts['one'])) {
return $stmt->fetch() ?: [];
}
return $stmt->fetchAll();
}
示例6: searchProviders
function searchProviders(Request $request)
{
$search = $request->input('search');
$users = User::where('role_id', 2) > where(function ($query) use($search) {
$query->Where('name', 'like', '%' . $search . '%')->orWhere('last_name', 'like', '%' . $search . '%')->orWhere('email', $search)->orWhere('second_name', 'like', '%' . $search . '%')->orWhere('second_last_name', 'like', '%' . $search . '%')->orWhere('identification', 'like', '%' . $search . '%');
})->paginate(50);
$roleName = $this->roleName;
$routeSearch = 'searchProvider';
return view('back.users', compact('users', 'roleName', 'routeSearch', 'search'));
}
示例7: index
public function index()
{
$home = get_row('home');
$sale = where('sold = 0 && purpose = 1')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
$rent = where('sold = 0 && purpose = 2')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
$projects = where('sold = 0 && type = 3')->limit(5)->order_by('create_date DESC')->get('skarabee/property');
echo view('head', array('class' => 'home', 'css' => 'home', 'title' => $home->seo_title ? $home->seo_title : $home->title, 'description' => $home->seo_content ? $home->seo_content : $home->content));
echo view('home', array('home' => $home, 'sale' => $sale, 'rent' => $rent, 'projects' => $projects));
echo view('foot', array('js' => 'home'));
}
示例8: tiempo_vida
function tiempo_vida($nombre)
{
$this->db->select('tiempo_vida');
$this->db - where('nombre', $nombre);
$tiempo = $this->db->get('producto');
if ($tiempo->num_rows() > 0) {
return $tiempo->result();
} else {
return false;
}
}
示例9: leftframe
public function leftframe()
{
//左边的默认首页
$table = D('apptree');
$pid = $_GET['apptreeid'];
$leftdate = $table->findAll("type='0' and pid ='{$pid}'");
foreach ($leftdate as $k => $v) {
$leftdate[$k]['subapp'] = where(' pid =' . $v[id])->field('*')->order('seqNO ASC')->findall();
}
$this->assign('left', $leftdate);
//dump($leftdate);
$this->display();
}
示例10: excluirFuncionario
public function excluirFuncionario($id_funcionario)
{
$result = false;
if (!isset($_SESSION)) {
session_start();
}
if (!isset($_SESSION['restaurante'])) {
return $result;
}
if (!empty($id_funcionario)) {
$this->_db > where("id_restaurante", $_SESSION['restaurante']);
$this->_db > where("id_funcionario", $id_funcionario);
return $this->_db->delete("functionario");
}
return $result;
}
示例11: get_site_id
private static function get_site_id()
{
$site = current_site();
if ($site->piwik_id) {
return $site->piwik_id;
}
$request = 'http://' . self::$api_urls[$_SERVER['SERVER_ADDR']] . '/?module=API&method=SitesManager.getSitesIdFromSiteUrl&url=http://' . rawurlencode($_SERVER['HTTP_HOST']) . '/&format=XML&token_auth=' . self::$auth_token;
$result = simplexml_load_string(curl($request));
if (isset($result->row->idsite)) {
$site_id = $result->row->idsite;
} else {
$site_id = self::create_site();
}
where('id = %d', $site->id)->update('site', array('piwik_id' => $site_id));
return $site_id;
}
示例12: bind
/**
* Bind params, alias where()
* in query use :param after binding.
* @param array $data array('param'=>'value')
* @return none
*/
public function bind($data)
{
foreach ($data as $key => $value) {
where($key, $value);
}
}
示例13: function_delete
public function function_delete($field, $object, $data, $id)
{
$fieldname = strval($field['name']);
$field_filename = strval($field['name']) . '_filename';
if (is_object($data)) {
if ($data->{$fieldname}) {
$data->{$fieldname}->clear_thumbnails();
}
@unlink(FILESPATH . $data->{$field_filename});
where('id = %d', $data->id)->update($object['stack'], array($fieldname . '_filename' => '', $fieldname . '_orig_filename' => '', $fieldname . '_upload_date' => ''));
redirect($_SERVER['HTTP_REFERER']);
} else {
error(404);
}
}
示例14: where_check
/** Create SQL condition from query string
* @param string
* @param array
* @return string
*/
function where_check($val, $fields = array())
{
parse_str($val, $check);
remove_slashes(array(&$check));
return where($check, $fields);
}
示例15: array
if ($f['size']) {
$toinsert = array();
$extension = substr($f['name'], strrpos($f['name'], '.') + 1);
do {
$name = md5(rand(0, 99999) . rand(0, 99999));
} while (file_exists(FILESPATH . $name . "." . $extension));
move_uploaded_file($f['tmp_name'], FILESPATH . $name . "." . $extension);
$toinsert['orig_filename'] = $f['name'];
$toinsert['filename'] = $name . '.' . $extension;
$toinsert['upload_date'] = time();
$toinsert["site_id"] = intval($site->id);
insert('site>downloads', $toinsert);
}
}
}
$site = where('id = %d', $site->id)->get_row('site');
?>
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php
echo l(array('nl' => 'Downloads', 'en' => 'Downloads', 'fr' => 'Downloads'));
?>
</title>