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


PHP Room::fetchFromParameters方法代码示例

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


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

示例1: runSearch

 public function runSearch()
 {
     $this->errors = array();
     $searchResults = array();
     $totalCapacity = $this->searchCritieria->adultsCount + $this->searchCritieria->childrenCount;
     $searchSql = "SELECT * FROM bsi_rooms WHERE capacity >= {$totalCapacity} AND id NOT IN (SELECT room_id FROM bsi_bookings WHERE ((start_date + INTERVAL 1 DAY) BETWEEN CAST('" . $this->searchCritieria->checkInDate->formatMySql() . "' AS DATE) AND CAST('" . $this->searchCritieria->checkOutDate->formatMySql() . "' AS DATE) OR (end_date - INTERVAL 1 DAY) BETWEEN CAST('" . $this->searchCritieria->checkInDate->formatMySql() . "' AS DATE) AND CAST('" . $this->searchCritieria->checkOutDate->formatMySql() . "' AS DATE) OR ((start_date + INTERVAL 1 DAY) < CAST('" . $this->searchCritieria->checkInDate->formatMySql() . "' AS DATE) AND (end_date - INTERVAL 1 DAY) > CAST('" . $this->searchCritieria->checkOutDate->formatMySql() . "' AS DATE)) OR  ((start_date + INTERVAL 1 DAY) > CAST('" . $this->searchCritieria->checkInDate->formatMySql() . "' AS DATE) AND (end_date - INTERVAL 1 DAY) < CAST('" . $this->searchCritieria->checkOutDate->formatMySql() . "' AS DATE))) AND is_deleted = 0)";
     $searchQuery = mysql_query($searchSql);
     if (!$searchQuery) {
         die("Error: " . mysql_error());
     }
     while ($searchRow = mysql_fetch_assoc($searchQuery)) {
         $matchingRoom = Room::fetchFromParameters($searchRow);
         array_push($searchResults, $matchingRoom);
     }
     return $searchResults;
 }
开发者ID:earthtravels,项目名称:maxtena,代码行数:16,代码来源:SearchEngine.class.php

示例2: fetchFromDbApartments

 public static function fetchFromDbApartments()
 {
     $rooms = array();
     $sql = "SELECT * FROM bsi_rooms WHERE is_apartment = 1";
     $query = mysql_query($sql);
     if (!$query) {
         global $logger;
         $logger->LogFatal("Error executing query: {$sql}");
         $logger->LogFatal("Database error: " . mysql_errno() . ". Message: " . mysql_error());
         die("Database error: " . mysql_errno() . ". Message: " . mysql_error());
     }
     while ($row = mysql_fetch_assoc($query)) {
         $room = Room::fetchFromParameters($row);
         $rooms[] = $room;
     }
     return $rooms;
 }
开发者ID:earthtravels,项目名称:maxtena,代码行数:17,代码来源:Room.class.php

示例3: array

<?php

// TODO: Uncomment
include "access.php";
include_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$errors = array();
$message = "";
$room = new Room();
$roomPricePlan = new RoomPricePlan();
if (isset($_POST['SBMT_REG'])) {
    $logger->LogInfo("Form has been submitted.");
    $room = Room::fetchFromParameters($_POST);
    if (!$room->save()) {
        $logger->LogError("Error saving room.");
        foreach ($room->errors as $error) {
            $logger->LogError($error);
            $errors[] = $error;
        }
    } else {
        $roomPricePlan = RoomPricePlan::fetchFromParameters($_POST);
        $roomPricePlan->id = intval($_POST['price_plan_id']);
        $roomPricePlan->isDefault = true;
        $roomPricePlan->roomId = $room->id;
        if (!$roomPricePlan->save()) {
            $logger->LogError("Error saving room.");
            foreach ($room->errors as $error) {
                $logger->LogError($error);
                $errors[] = $error;
            }
开发者ID:earthtravels,项目名称:maxtena,代码行数:31,代码来源:rooms_add_edit.php


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