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


PHP R::getCol方法代码示例

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


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

示例1: findLatestId

 public function findLatestId()
 {
     return (int) R::getCol("SELECT max(id) FROM " . $this->type)[0];
 }
开发者ID:MhmdLab,项目名称:redbean-slim,代码行数:4,代码来源:BeanRepository.php

示例2: implode

             //     . ' GROUP BY school_id '
             //    . ' HAVING MAX(applicationform.submitted)';
             $appFormIds = R::getCol($appFormIdsSql);
             if (empty($appFormIds)) {
                 return [];
             }
             $in = implode(',', array_fill(0, count($appFormIds), '?'));
             $sql = 'SELECT applicationform.id AS id, ' . ' school.registry_no AS school_registry_no, ' . ' school.name AS school_name, ' . ' FROM_UNIXTIME(applicationform.submitted) AS submitted, ' . ' lab.id AS lab_id, ' . ' TRIM(labtype.name) AS lab_type, ' . ' IF(lab.is_new = 1, "ΝΑΙ", "ΟΧΙ") AS is_new, ' . ' TRIM(itemcategory.name) AS category, ' . ' applicationformitem.qty AS qty, ' . ' TRIM(applicationformitem.reasons) AS reasons ' . ' FROM applicationformitem ' . ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id ' . ' LEFT JOIN school ON applicationform.school_id = school.id ' . ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id ' . ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id ' . ' LEFT JOIN labtype ON lab.labtype_id = labtype.id ' . ' WHERE applicationform.id IN(' . $in . ') ';
             $appForms = R::getAll($sql, $appFormIds);
             return $appForms;
         };
     };
     $c['csv_export_newapplication'] = function ($c) {
         return function () use($c) {
             $appFormIdsSql = 'SELECT id FROM applicationform WHERE (submitted) IN( SELECT MAX(submitted) FROM applicationform GROUP BY school_id)';
             $appFormIds = R::getCol($appFormIdsSql);
             if (empty($appFormIds)) {
                 return [];
             }
             $in = implode(',', array_fill(0, count($appFormIds), '?'));
             $settings = $c->get('settings');
             $version = $settings['application_form']['itemcategory']['currentversion'];
             $sql = 'SELECT applicationform.id AS id, ' . ' school.registry_no AS school_registry_no, ' . ' school.name AS school_name, ' . ' TRIM(itemcategory.name) AS category, ' . ' applicationformitem.qty AS qty, ' . ' applicationformitem.qtyacquired AS qtyacquired, ' . ' TRIM(applicationformitem.reasons) AS reasons ' . ' FROM applicationformitem ' . ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id ' . ' LEFT JOIN school ON applicationform.school_id = school.id ' . ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id ' . ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id ' . ' LEFT JOIN labtype ON lab.labtype_id = labtype.id ' . ' WHERE applicationform.id IN(' . $in . ')' . ' AND itemcategory.groupflag IN(' . $version . ')';
             $appForms = R::getAll($sql, $appFormIds);
             return $appForms;
         };
     };
 });
 $events('on', 'app.bootstrap', function (App $app, Container $c) {
     $app->get('/export/csv/edulabs_{type}.csv', function (Request $req, Response $res, array $args) use($c) {
         $type = $args['type'];
开发者ID:eellak,项目名称:gredu_labs,代码行数:31,代码来源:bootstrap.php

示例3: stat

 public function stat()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $where = [];
     $where[] = 1;
     $where = implode(" AND ", $where);
     $queryParam[] = $start;
     $queryParam[] = $perPage;
     $form = [];
     $form['room'] = '';
     $sub = 'SELECT SUM(product_room.view_count) FROM product_room WHERE product_room.product_id = product.id';
     $items = [];
     $count = 0;
     $maxPage = 0;
     if (!empty($_GET["room"])) {
         $form["room"] = $_GET["room"];
         $ids = R::getCol('SELECT product_id FROM product_room WHERE room_name = :room_name', [':room_name' => $_GET["room"]]);
         if (!empty($ids)) {
             $ids = array_unique($ids);
             $room = $_GET["room"];
             $sub .= " AND product_room.room_name = '{$room}' ";
             $where = ' id IN (' . R::genSlots($ids) . ')';
             $queryParam = array_merge($ids, $queryParam);
             $sql = 'SELECT *,(' . $sub . ') as total_room FROM product WHERE ' . $where . ' LIMIT ?,?';
             $items = R::getAll($sql, $queryParam);
             $count = R::count('product', $where, array_slice($queryParam, 0, -2));
             $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
         } else {
         }
     }
     $items = array_map(function ($item) {
         if (is_null($item["total_room"])) {
             $item["total_room"] = 0;
         }
         return $item;
     }, $items);
     $this->slim->render("room/stat_view.php", ['items' => $items, 'page' => $page, 'maxPage' => $maxPage, 'form' => $form]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:40,代码来源:RoomController.php


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