SELECT
e.id,
e.date_public,
ec.id AS cat_id,
ec.title AS cat_title
FROM
events e
INNER JOIN
event_category_joins ecj ON e.id = ecj.event_id
INNER JOIN
event_categories ec ON ec.id = ecj.event_category_id
INNER JOIN
(
SELECT
ec.id AS cat_id,
MIN(e.date_public) AS min_date_public
FROM
events e
INNER JOIN
event_category_joins ecj ON e.id = ecj.event_id
INNER JOIN
event_categories ec ON ec.id = ecj.event_category_id
WHERE
e.date_public >= CURDATE()
GROUP BY
ec.id
) ec_min ON ec.id = ec_min.cat_id AND e.date_public = ec_min.min_date_public
ORDER BY
e.date_public ASC;
// загрузка изображения
var file_upload = $('#file_upload');
var files_obj= {};
file_upload.on('change', function(){
if((file_upload[0].files).length !=0){
$.each(file_upload[0].files, function(i, file){
//добавляем данные в созданный объект
files_obj[file.name] = file;
});
}
let arr_files = Object.values(files_obj);
// Далее отправка через ajax
//......
//......
});
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
alert("Вы используете мобильное устройство (телефон или планшет).")
} else alert("Вы используете ПК.")
SELECT d.*, ev1.*
FROM devices d
INNER JOIN eventlog ev1 ON d.id_device = ev1.id_device
AND ev1.id_place IN(1,2,3) GROUP BY ev1.id_device
SELECT d.*, e.*
FROM devices d INNER JOIN eventlog e ON e.id_device = d.id_device AND e.id_device = ".$val." ORDER BY e.id_event DESC LIMIT 1