0){ mysql_query("UPDATE user_sub_comments SET sub_comment='{$sub_comment}', user_for='{$user_for}' WHERE id={$sub_id}"); } else { mysql_query("INSERT INTO `user_sub_comments` (`event_id`, `req_id`, `section_id`, `sub_comment`, `created_by`, `user_for`) VALUES ('$event_id', '$req_id', 1, '$sub_comment', '$_SESSION[id]', '$user_for')"); } } else { mysql_query("DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 1 AND `created_by` = '$_SESSION[id]'"); mysql_query("INSERT INTO `user_sub_comments` (`event_id`, `req_id`, `section_id`, `sub_comment`, `created_by`) VALUES ('$event_id', '$req_id', 1, '$sub_comment', '$_SESSION[id]')"); } } else if ($from == "clients") { mysql_query("DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 2 AND `created_by` = '$_SESSION[id]'"); mysql_query("INSERT INTO `user_sub_comments` (`event_id`, `req_id`, `section_id`, `sub_comment`, `created_by`) VALUES ('$event_id', '$req_id', 2, '$sub_comment', '$_SESSION[id]')"); } else if ($from == "requisitions") { mysql_query("DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 3 AND `created_by` = '$_SESSION[id]'"); mysql_query("INSERT INTO `user_sub_comments` (`event_id`, `req_id`, `section_id`, `sub_comment`, `created_by`) VALUES ('$event_id', '$req_id', 3, '$sub_comment', '$_SESSION[id]')"); } if ($req_id > 0) { //mysql_query("INSERT INTO `user_client_events` (`user_id`, `req_id`, `from_id`, `type`, `comment`) VALUES ('$_SESSION[id]', '$req_id', '$_SESSION[id]', 'sub_comment', '{$sub_comment}')"); mysql_query("INSERT INTO `events_clients` (`user_id`, `req_id`, `from_id`, `event`, `read`, `dop_text`) VALUES ('$_SESSION[id]', '$req_id', '0', 'sub_comment', '1', '{$sub_comment}')"); } } }