Joywork/ajax/edit_installment_info.php

26 lines
1.0 KiB
PHP
Raw Normal View History

2026-05-22 20:21:54 +02:00
<?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);
}
}
?>