本文整理汇总了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;
}
示例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;
}
示例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;
}