26 lines
1.0 KiB
PHP
26 lines
1.0 KiB
PHP
<?php
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
|
|
|
|
$apartment_id = $_GET['apartment_id'];
|
|
$user_id = $_SESSION['id'];
|
|
$new_installment_price = $_POST['new_installment_price'];
|
|
$presentation_note = mysql_real_escape_string(cleanHtml($_POST['presentation_note'], '<p><br><strong><em><ul><ol><li>'));
|
|
|
|
if($apartment_id && $user_id) {
|
|
|
|
$sql = "SELECT * FROM sended_pdf_complexes WHERE id_agent = '$user_id' AND id_object='$apartment_id'";
|
|
$rez = mysql_query($sql);
|
|
|
|
if (mysql_num_rows($rez) > 0) {
|
|
$sql = "UPDATE sended_pdf_complexes SET new_presentation_note ='$presentation_note', new_installment_price ='$new_installment_price' WHERE id_agent = '$user_id' AND id_object='$apartment_id'";
|
|
// var_dump($sql);die;
|
|
|
|
mysql_query($sql);
|
|
|
|
} else {
|
|
$sql = "INSERT INTO sended_pdf_complexes (new_installment_price, new_presentation_note, id_agent, id_object) VALUES ('$new_installment_price, $presentation_note', '$user_id', '$apartment_id')";
|
|
// var_dump($sql);die;
|
|
mysql_query($sql);
|
|
}
|
|
}
|
|
?>
|