48 lines
1.7 KiB
PHP
48 lines
1.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Храним в БД
|
||
|
|
*/
|
||
|
|
class ApartmentHistory
|
||
|
|
{
|
||
|
|
function saveDataForReservation($reservationId, $apartmentSerialized, $blockSerialized,
|
||
|
|
$buildingSerialized, $builderSerialized, $roomTypeSerialized,
|
||
|
|
$decorationTypeSerialized, $regionSerialized, $subwaysSerialized,
|
||
|
|
$imagesSerialized, $banksSerialized, $docsSerialized, $flatTypeSerialized)
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
$sql = "INSERT INTO apartment_reservation_data (reservation_id, apartment,
|
||
|
|
block, builder, building, roomType, decorationType, region, subways, images, banks, docs, flatType) VALUES ('"
|
||
|
|
. $reservationId . "', '". $apartmentSerialized . "', '" . $blockSerialized . "', '" . $builderSerialized .
|
||
|
|
"', '" . $buildingSerialized . "', '" . $roomTypeSerialized . "', '" .
|
||
|
|
$decorationTypeSerialized . "', '" . $regionSerialized . "', '" . $subwaysSerialized .
|
||
|
|
"', '" . $imagesSerialized . "', '" . $banksSerialized . "', '" . $docsSerialized . "', '" . $flatTypeSerialized . "')";
|
||
|
|
mysql_query($sql);
|
||
|
|
$err = mysql_errno();
|
||
|
|
if ($err > 0) {
|
||
|
|
echo mysql_error();
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
} catch (Exception $e) {
|
||
|
|
echo $e->getMessage();
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
function getData($reservationId)
|
||
|
|
{
|
||
|
|
$sql="SELECT * FROM apartment_reservation_data WHERE reservation_id = '$reservationId'";
|
||
|
|
|
||
|
|
$rez=mysql_query($sql);
|
||
|
|
|
||
|
|
if(mysql_num_rows($rez)) {
|
||
|
|
|
||
|
|
return mysql_fetch_assoc($rez);
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|