INSERT INTO table_name (`column1`, `column2`, `column3`, `date`)
VALUES ('value1', 'value2', 'value3', CURDATE())
ON DUPLICATE KEY UPDATE
`column1`=VALUES(`column1`),
`column2`=VALUES(`column2`),
`column3`=VALUES(`column3`);
$arr = [
[
'ID' => '105653877',
'CABLAB_NAME' => 'Участок',
'DEPARTMENT_NAME' => 'Отдел',
'DEPARTMENT_KIND' => '6405222',
'EMPLOYER_ID' => '78621962',
'EMPLOYER_NAME' => 'Иванов И. И.',
'SERVICE_ID' => '',
'SERVICE_NAME' => '',
'DEVICE_NAME' => '',
'DAY_NUMBER' => '1',
'HOURS_BEGIN' => '08',
'MINS_BEGIN' => '00',
'HOURS_END' => '14',
'MINS_END' => '00',
'TIME_BEGIN_S' => '08:00',
'TIME_END_S' => '14:00',
'TIME_TYPE' => '6338504',
'TIME_TYPE_CODE' => '1',
'RCOUNT' => '1',
'RCOUNTMAX' => '',
'TIME_OR_COUNT' => '0',
'RTIME_PRIM' => '15',
'SORT_F' => '2',
'ONLY_VIEW' => '0',
],
[
'ID' => '105653877',
'CABLAB_NAME' => 'Участок',
'DEPARTMENT_NAME' => 'Отдел',
'DEPARTMENT_KIND' => '6405222',
'EMPLOYER_ID' => '78621962',
'EMPLOYER_NAME' => 'Иванов И. И.',
'SERVICE_ID' => '',
'SERVICE_NAME' => '',
'DEVICE_NAME' => '',
'DAY_NUMBER' => '3',
'HOURS_BEGIN' => '08',
'MINS_BEGIN' => '00',
'HOURS_END' => '14',
'MINS_END' => '00',
'TIME_BEGIN_S' => '08:00',
'TIME_END_S' => '14:00',
'TIME_TYPE' => '6338504',
'TIME_TYPE_CODE' => '1',
'RCOUNT' => '1',
'RCOUNTMAX' => '',
'TIME_OR_COUNT' => '0',
'RTIME_PRIM' => '15',
'SORT_F' => '2',
'ONLY_VIEW' => '0',
],
[
'ID' => '105653877',
'CABLAB_NAME' => 'Участок',
'DEPARTMENT_NAME' => 'Отдел',
'DEPARTMENT_KIND' => '6405222',
'EMPLOYER_ID' => '78621962',
'EMPLOYER_NAME' => 'Иванов И. И.',
'SERVICE_ID' => '',
'SERVICE_NAME' => '',
'DEVICE_NAME' => '',
'DAY_NUMBER' => '5',
'HOURS_BEGIN' => '08',
'MINS_BEGIN' => '00',
'HOURS_END' => '14',
'MINS_END' => '00',
'TIME_BEGIN_S' => '08:00',
'TIME_END_S' => '14:00',
'TIME_TYPE' => '6338504',
'TIME_TYPE_CODE' => '1',
'RCOUNT' => '1',
'RCOUNTMAX' => '',
'TIME_OR_COUNT' => '0',
'RTIME_PRIM' => '15',
'SORT_F' => '2',
'ONLY_VIEW' => '0',
]
];
$new_arr = [];
foreach ($arr as $index => $item) {
$id = $item['ID'];
$new_arr[$id] = $new_arr[$id] ?? $item;
$day = $item['DAY_NUMBER'];
$days = explode(', ', $new_arr[$id]['DAY_NUMBER']);
if (!in_array($day, $days))
$days[] = $day;
sort($days);
$new_arr[$id]['DAY_NUMBER'] = implode(', ', $days);
}
$(document).on("click", ".event__checkbox", function () {
(function (cb) {
cb.prop("checked") ? cb.closest("@event_item").addClass("events-list__item_checked") : cb.closest("@event_item").removeClass("events-list__item_checked");
cb.prop("checked") ? cb.closest("@event_checker").attr({title: "Пометить как прочитанное"}) : cb.closest("@event_checker").attr({title: "Пометить как непрочитанное"});
$.post("tracker/feed_mark_seen_event", {
event_id: cb.data("event_id"),
state: cb.prop("checked") ? 1 : 0
}, "json").fail(fail_func)
})($(this))
});
$order_ids_approved = $wpdb->get_results( "SELECT `ID` FROM `avt_posts` WHERE `post_status` = 'wc-approved' AND (`post_date` BETWEEN '{$start_day}' AND '{$end_day}')", OBJECT_K);
foreach($rows as $key => $row)
$(function() {
$('#text-search').unbind().bind('keyup change', function(e){
if (e.keyCode == 13){
e.preventDefault();
console.log($('span.highlight.viewed'));
var highlights = $('span.highlight');
if (highlights.length){
var viewed = $('span.highlight.viewed');
if (viewed.length >= highlights.length){
viewed.removeClass('viewed');
viewed = $('span.highlight.viewed');
}
if (viewed.length < highlights.length){
var noViewed = highlights.parent().find('span.highlight:not([class*="viewed"])');
var firstNoViewed = noViewed.first();
var searchPosition = firstNoViewed.offset();
var searchPositionTop = searchPosition.top;
var windowHeight = window.innerHeight;
var windowHeightHalf = windowHeight / 2;
var scrollPosition = (searchPositionTop > windowHeightHalf) ? (searchPositionTop - windowHeightHalf) : 0;
window.scrollTo(0, scrollPosition);
firstNoViewed.addClass('viewed');
}
}
} else {
var searchTerm = $(this).val();
$('body').removeHighlight();
if (searchTerm){
$('body').highlight(searchTerm);
}
}
});
});