本文整理汇总了PHP中Sql::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::getOne方法的具体用法?PHP Sql::getOne怎么用?PHP Sql::getOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::getOne方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$array_template = array('title' => '', 'data' => array(), 'show_in' => array());
$all_levels = array('vertical' => $array_template, 'nt' => $array_template, 'fellow' => $array_template, 'coach' => $array_template);
$all_levels['vertical']['show_in'] = array('national');
$all_levels['nt']['show_in'] = array('national', 'vertical');
$all_levels['fellow']['show_in'] = array('national', 'vertical');
$all_levels['coach']['show_in'] = array('national', 'vertical');
/*$all_levels['volunteer']['show_in'] = array('national', 'vertical');*/
foreach ($all_levels as $key => $level_info) {
if (in_array($view_level, $level_info['show_in'])) {
$name = ucfirst($key);
if ($name == 'Nt') {
$name = 'National Team';
}
$title = 'Top ' . $name;
if ($vertical_id) {
$vertical_name = $sql_madapp->getOne("SELECT name FROM Vertical WHERE id={$vertical_id}");
$title .= " in {$vertical_name}";
$children_sponsored_title = " by " . $vertical_name;
} else {
$children_sponsored_title = "Nationally";
}
if ($timeframe == '1') {
$title .= " on " . date("jS M");
} elseif ($timeframe == '7') {
$title .= " for last week(" . date("jS M", strtotime("last week")) . ")";
}
$all_levels[$key]['title'] = $title;
$all_levels[$key]['area'] = $all_levels[$key]['data'] = getData($key);
$all_levels['children_sponsored_title'] = $children_sponsored_title;
}
}
示例2: ucfirst
foreach ($all_levels as $key => $level_info) {
if (in_array($view_level, $level_info['show_in'])) {
$name = ucfirst($key);
if ($name == 'User') {
$name = 'Fundraiser';
}
if ($name == 'Group') {
$name = 'Center';
}
$title = 'Top ' . $name;
if ($group_id) {
$city_name = $sql->getOne("SELECT name FROM cities WHERE id={$city_id}");
$title .= " in {$city_name}";
$group_name = $sql->getOne("SELECT name FROM groups WHERE id={$group_id}");
$children_sponsored_title = " by " . $group_name;
$children_count = $sql_madapp->getOne("SELECT COUNT(*) FROM Student\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN Center\n\t\t\t\t\t\t\t\t\t\t\tON Center.id = Student.center_id\n\t\t\t\t\t\t\t\t\t\t\tWHERE Student.status = 1 AND Center.name = '{$group_name}'");
} elseif ($city_id) {
$city_name = $sql->getOne("SELECT name FROM cities WHERE id={$city_id}");
$title .= " in {$city_name}";
$children_sponsored_title = " by " . $city_name;
$madapp_city_id = city_transilation_donut_to_madapp($city_id);
$children_count = $sql_madapp->getOne("SELECT COUNT(*) FROM Student\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN Center\n\t\t\t\t\t\t\t\t\t\t\tON Center.id = Student.center_id\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN City\n\t\t\t\t\t\t\t\t\t\t\tON City.id = Center.city_id\n\t\t\t\t\t\t\t\t\t\t\tWHERE Student.status = 1 AND Center.status = 1 AND City.id = {$madapp_city_id}");
} elseif ($state_id) {
$state_name = $sql->getOne("SELECT name FROM states WHERE id={$state_id}");
$title .= " in {$state_name}";
$children_sponsored_title = " by " . $state_name;
$madapp_region_id = state_transilation_donut_to_madapp($state_id);
$children_count = $sql_madapp->getOne("SELECT COUNT(*) FROM Student\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN Center\n\t\t\t\t\t\t\t\t\t\t\tON Center.id = Student.center_id\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN City\n\t\t\t\t\t\t\t\t\t\t\tON City.id = Center.city_id\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN Region\n\t\t\t\t\t\t\t\t\t\t\tON Region.id = City.region_id\n\t\t\t\t\t\t\t\t\t\t\tWHERE Student.status = 1 AND Center.status = 1 AND Region.id = {$madapp_region_id}");
} else {
$children_sponsored_title = "Nationally";
$children_count = $sql_madapp->getOne("SELECT COUNT(*) FROM Student\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN Center\n\t\t\t\t\t\t\t\t\t\t\tON Center.id = Student.center_id\n\t\t\t\t\t\t\t\t\t\t\tWHERE Student.status = 1 AND Center.status = 1");