当前位置: 首页>>代码示例>>PHP>>正文


PHP Sql::getById方法代码示例

本文整理汇总了PHP中Sql::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::getById方法的具体用法?PHP Sql::getById怎么用?PHP Sql::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sql的用法示例。


在下文中一共展示了Sql::getById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

$timeframe = intval(i($QUERY, 'timeframe', '0'));
$view = i($QUERY, 'view', 'top');
$action = i($QUERY, 'action', '');
$vertical_id = i($QUERY, 'vertical_id', 0);
$QUERY['no_cache'] = 1;
if ($view_level != 'vertical') {
    $vertical_id = 0;
}
setlocale(LC_MONETARY, 'en_IN');
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$year = 2015;
$cache_expire = 60 * 60;
$top_count = 30;
//Ignoring verticals that are not being used anymore
$all_verticals = $sql_madapp->getById("SELECT id,name FROM Vertical WHERE id <> 1 AND id <> 2 AND id <> 10 AND id <> 11 AND id <> 12 AND id <> 13 AND id <> 14 AND id <> 15 ORDER BY name");
$all_view_levels = array('national' => "National", 'vertical' => "Vertical");
// , 'coach' => "Coach"
$all_timeframes = array('1' => 'Day', '7' => 'Week', '0' => 'Overall');
$checks = array('is_deleted' => 'users.is_deleted=0');
if ($vertical_id and $view_level == 'vertical') {
    $checks['vertical_id'] = "G.vertical_id={$vertical_id}";
}
if ($timeframe) {
    $checks['timeframe'] = "D.created_at > DATE_SUB(NOW(), INTERVAL {$timeframe} DAY)";
}
$user_checks = $checks;
unset($user_checks['timeframe']);
$filter = "WHERE {$city_checks}";
if ($checks) {
    $filter .= " AND " . implode(" AND ", array_values($checks));
开发者ID:makeadiff,项目名称:infogen,代码行数:31,代码来源:vertical.php

示例2: Sql

    $sql_donut = new Sql($config_data['db_host'], $config_data['db_user'], $config_data['db_password'], "makeadiff_cfrapp");
    $sql_madapp = new Sql($config_data['db_host'], $config_data['db_user'], $config_data['db_password'], "makeadiff_madapp");
} else {
    $sql_donut = new Sql("Project_Donut");
    $sql_madapp = new Sql("Project_Madapp");
}
// Argument Parsing.
$madapp_city_id = i($QUERY, 'madapp_city_id', 10);
$donut_city_id = $city_transilation[$madapp_city_id];
$group_id = i($QUERY, 'group_id', 13);
$action = i($QUERY, 'action', '');
$year = 2015;
$group_name = '';
$madapp_users_in_current_group = array();
// if(!$city_id) die("No city specified");
$all_cities = $sql_madapp->getById("SELECT id,name FROM City");
$all_groups = $sql_donut->getById("SELECT id,name,city_id AS donut_city_id FROM groups");
$all_verticals = $sql_madapp->getById("SELECT id,name FROM Vertical");
foreach ($all_groups as $this_group_id => $group) {
    $all_groups[$this_group_id]['city_id'] = city_transilation_donut_to_madapp($group['donut_city_id']);
}
if ($action == 'Save Group') {
    $selected_users = $QUERY['donut_group_users'];
    $group_id = $QUERY['group_id'];
    $donut_users_ids = $sql_donut->getById("SELECT madapp_user_id, id FROM users WHERE madapp_user_id IN (" . implode(',', $selected_users) . ")");
    foreach ($donut_users_ids as $madapp_id => $user_id) {
        $sql_donut->execQuery("UPDATE users SET group_id={$group_id} WHERE id={$user_id} ");
    }
    $action = 'Fetch';
}
if ($action == 'Fetch') {
开发者ID:makeadiff,项目名称:infogen,代码行数:31,代码来源:assignment.php


注:本文中的Sql::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。