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


PHP R::getRow方法代码示例

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


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

示例1: show

 public function show($email)
 {
     $passwordReset = R::getRow('SELECT `users`.`id` AS `userId`, `passwordResets`.`id`, `passwordResets`.`token`, `passwordResets`.`created`
         	FROM ( `users` )
         LEFT JOIN `passwordResets`
         	ON ( `passwordResets`.`userId` = `users`.`id` )
         WHERE `users`.`email` = :email', [':email' => $email]);
     return !empty($passwordReset) ? $passwordReset : false;
 }
开发者ID:aodkrisda,项目名称:slim3-api,代码行数:9,代码来源:PasswordResets.php

示例2: login

 public static function login($username, $password)
 {
     $row = R::getRow("SELECT * FROM `user` WHERE username = ? ", array($username));
     if ($row != null && password_verify($password, $row["password"])) {
         $_SESSION["username"] = $username;
         $_SESSION["password"] = $password;
         return true;
     } else {
         unset($_SESSION["username"]);
         unset($_SESSION["password"]);
         return false;
     }
 }
开发者ID:louislam,项目名称:louislam-crud,代码行数:13,代码来源:Auth.php

示例3: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('contactdealer', 'LIMIT ?,?', [$start, $perPage]);
     $count = R::count('contactdealer');
     foreach ($items as &$item) {
         $item->ownProvince = R::getRow('SELECT * FROM provinces WHERE province_id=?', [$item->province_id]);
         $item->ownGeography = R::getRow('SELECT * FROM geography WHERE geo_id=?', [$item->geo_id]);
         // var_dump($item); exit();
     }
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $this->slim->render("contactdealer/list.php", ['items' => $items, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:15,代码来源:ContactdealerController.php

示例4: save

 public function save()
 {
     if (!$this->emptyAttr('id')) {
         $contactDealer = R::findOne('contactdealer', 'id=?', [$this->getAttr('id')]);
         $contactDealer->updated_at = date('Y-m-d H:i:s');
     } else {
         $contactDealer = R::dispense('contactdealer');
         $contactDealer->created_at = date('Y-m-d H:i:s');
         $contactDealer->updated_at = date('Y-m-d H:i:s');
     }
     $contactDealer->name = $this->getAttr('name');
     $contactDealer->address = $this->getAttr('address', '');
     $contactDealer->phone = $this->getAttr('phone', '');
     $contactDealer->province_id = $this->getAttr('province_id', '');
     $contactDealer->geo_id = $this->getAttr('geo_id', '');
     $contactDealer->lat = $this->getAttr('lat', '');
     $contactDealer->lng = $this->getAttr('lng', '');
     $province = R::getRow('SELECT * FROM provinces WHERE province_id = ?', [$contactDealer->province_id]);
     if ($province) {
         $contactDealer->geo_id = $province['geo_id'];
     }
     $success = R::store($contactDealer);
     return $success;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:24,代码来源:ContactdealerForm.php

示例5: addRoomUse

 public function addRoomUse()
 {
     $productId = $this->slim->request->post()['product_id'];
     $roomName = $this->slim->request->post()['room_name'];
     $item = R::findOne('product', 'id=?', [$productId]);
     if (!$item) {
         header('Content-Type: application/json');
         echo json_encode(['error' => 'NOT_FOUND_PRODUCT'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
         exit;
     }
     $dateStr = date('Y-m-d');
     $productView = R::getRow('SELECT * FROM product_room WHERE product_id=? AND room_name=? AND view_date=?', [$productId, $roomName, $dateStr]);
     if (!$productView) {
         R::exec('INSERT INTO product_room SET product_id=?, room_name=? , view_date=?', [$productId, $roomName, $dateStr]);
     }
     R::exec('UPDATE product_room SET view_count = view_count+1 WHERE product_id=? AND room_name=? AND view_date=?', [$productId, $roomName, $dateStr]);
     header('Content-Type: application/json');
     echo json_encode(['successs' => true], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:20,代码来源:ApiProductController.php

示例6: productAddStat

 public function productAddStat($productId)
 {
     $dateStr = date('Y-m-d');
     $productView = R::getRow('SELECT * FROM product_add WHERE product_id=? AND add_date=?', [$productId, $dateStr]);
     if (!$productView) {
         R::exec('INSERT INTO product_add SET product_id=?, add_date=?', [$productId, $dateStr]);
     }
     R::exec('UPDATE product_add SET add_count = add_count+1 WHERE product_id=? AND add_date=?', [$productId, $dateStr]);
     header('Content-Type: application/json');
     echo json_encode(['success' => true], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:12,代码来源:ApiAccountController.php

示例7: build

 public function build(&$item)
 {
     $item['province'] = R::getRow('SELECT * FROM provinces WHERE province_id=?', [$item['province_id']]);
     $item['geography'] = R::getRow('SELECT * FROM geography WHERE geo_id=?', [$item['geo_id']]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:5,代码来源:ApiContactdealerController.php


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