本文整理汇总了PHP中query::where方法的典型用法代码示例。如果您正苦于以下问题:PHP query::where方法的具体用法?PHP query::where怎么用?PHP query::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类query
的用法示例。
在下文中一共展示了query::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_popup
public static function get_popup($user_id)
{
$q = new query(RUDE_DATABASE_TABLE_SETTINGS);
$q->where(RUDE_DATABASE_FIELD_USER_ID, (int) $user_id);
$q->where(RUDE_DATABASE_FIELD_NAME, 'popup');
$q->query();
return $q->get_object();
}
示例2: scopeCleanOrigin
/**
* Scope only original data without machine error and without data marked as real error (-9999)
* @param query $query Query Object
* @param string $type Data type ("WATER", "RAIN")
* @return mixed new query object
*/
public function scopeCleanOrigin($query, $type)
{
if ($type == 'WATER') {
return $query->where('origin_water1', '!=', '999999')->where('origin_water1', '!=', '-9999');
} elseif ($type == 'RAIN') {
return $query->where('origin_rain1h', '!=', '999999')->where('origin_rain1h', '!=', '-9999');
}
}
示例3: get_by_report
public static function get_by_report($report_id)
{
$q = new query(RUDE_DATABASE_TABLE_EDUCATION);
$q->where(RUDE_DATABASE_FIELD_REPORT_ID, (int) $report_id);
$q->where('not_save', (int) 0);
$q->query();
return $q->get_object_list();
}
示例4: get
public static function get($report_id = null, $year = null)
{
$q = new query(RUDE_DATABASE_TABLE_CALENDAR_ITEMS);
if ($year !== null) {
$q->where(RUDE_DATABASE_FIELD_YEAR, (int) $year);
}
if ($report_id !== null) {
$q->where(RUDE_DATABASE_FIELD_REPORT_ID, (int) $report_id);
}
$q->query();
return $q->get_object_list();
}
示例5: get_by_shortname
public static function get_by_shortname($shortname)
{
$q = new query(RUDE_DATABASE_TABLE_FACULTIES);
$q->where(RUDE_DATABASE_FIELD_SHORTNAME, $shortname);
$q->query();
return $q->get_object();
}
示例6: get_by_name
public static function get_by_name($name)
{
$q = new query(RUDE_DATABASE_TABLE_QUALIFICATIONS);
$q->where(RUDE_DATABASE_FIELD_NAME, $name);
$q->query();
return $q->get_object();
}
示例7: scopeDataType
/**
* Score by data type
* @param query $query query object
* @param string $type data type (water, rain)
* @return mixed new query object
*/
public function scopeDataType($query, $type)
{
$query->join('tele_station', 'problems.station_code', '=', 'tele_station.code')->select('problems.id', 'code', 'name', 'problem_type', 'tambon_name', 'amphoe_name', 'province_name', 'part', 'basin', 'start_datetime', 'end_datetime', 'num', 'problems.status');
if ($type) {
return $query->where('data_type', '=', $type);
}
return $query;
}
示例8: get_by_order
public static function get_by_order($education_id)
{
$q = new query(RUDE_DATABASE_TABLE_EDUCATION_ITEMS_VALUES);
$q->where('education_id', (int) $education_id);
$q->order_by('order_num', 'ASC');
$q->query();
return $q->get_object_list();
}
示例9: is_exists
public static function is_exists($id)
{
$q = new query(RUDE_DATABASE_TABLE_USERS);
$q->where(RUDE_DATABASE_FIELD_ID, (int) $id);
$q->query();
if ($q->get_object()) {
return true;
}
return false;
}
示例10: is_exists
public static function is_exists($name)
{
$q = new query(RUDE_DATABASE_TABLE_TRAINING_FORM);
$q->where(RUDE_DATABASE_FIELD_NAME, $name);
$q->query();
if ($q->get_object()) {
return true;
}
return false;
}
示例11: get
public static function get($id = null)
{
$q = new query(RUDE_DATABASE_TABLE_CALENDAR_LEGEND);
if ($id !== null) {
$q->where(RUDE_DATABASE_FIELD_ID, (int) $id);
$q->query();
return $q->get_object();
}
$q->query();
return $q->get_object_list();
}
示例12: get
public static function get($id = null)
{
$q = new query(RUDE_DATABASE_TABLE_REPORTS_CATEGORIES_ITEMS);
if ($id !== null) {
$q->where(RUDE_DATABASE_FIELD_ID, (int) $id);
$q->query();
return $q->get_object();
}
$q->query();
return $q->get_object_list();
}
示例13: scopeFilter
/**
* scope query with filter options
* @param query $query
* @return Query
*/
public static function scopeFilter($query)
{
if ($name = \Request::get('q')) {
$query->where('name', 'like', "%{$name}%");
$query->orWhere('asset_no', 'like', "%{$name}%");
$query->orWhere('model', 'like', "%{$name}%");
}
if ($category_id = \Request::get('category_id')) {
$query->where('category_id', '=', $category_id);
}
if ($department_id = \Request::get('department_id')) {
$query->where('department_id', '=', $department_id);
}
if ($vendor_id = \Request::get('vendor_id')) {
$query->where('vendor_id', '=', $vendor_id);
}
if ($status = \Request::get('status')) {
$query->where('status', '=', $status);
}
return $query;
}
示例14: get
public static function get($id = null)
{
$q = new query(RUDE_DATABASE_TABLE_SPECIALIZATIONS);
if ($id !== null) {
$q->where(RUDE_DATABASE_FIELD_ID, (int) $id);
$q->query();
return $q->get_object();
}
$q->order_by(RUDE_DATABASE_FIELD_NAME);
$q->query();
return $q->get_object_list();
}
示例15: save
/**
* Save the user instance in database
* @return Boolean true if successfully saved, false otherwise
*/
public function save()
{
// Si l'utilisateur existe, on le met à jour
if ($this->ok()) {
// Mise à jour de l'utilisateur
$user = new query();
$user->update('user');
foreach ($this->field as $key => $value) {
switch ($key) {
case "id":
case "login":
// On ne modifie jamais l'ID de l'utilisateur et on enregistre pas le temps de mise à jour de la session s'il y en a une.
break;
default:
// On modifie la ligne
$user->set($key, trim($value));
break;
}
}
$user->where('id', '=', $this->get('id'));
$user->exec();
//Mise à jour des options
foreach ($this->create as $create) {
$query = new query();
$query->insert('user_option')->set('key', $create)->set('value', $this->option[$create])->set('owner', $this->get('id'))->exec();
}
foreach ($this->change as $change) {
$query = new query();
$query->update('user_option')->set('value', $this->option[$change])->where('owner', '=', $this->get('id'))->where('key', '=', $change)->exec();
}
return true;
// Si l'utilisateur n'existe pas, impossible de le mettre à jour, on retourne une erreur.
} else {
$user = new query();
$user->insert('user')->set('username', $this->get('username'));
$id = $user->exec();
$this->set('id', $id);
$this->ok = true;
$this->save();
return true;
}
}