$stmt = mysqli_prepare($connect, "INSERT INTO *** (fio,email,age,anw1,anw2,frequency) VALUES (?, ?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, "ssssss", $fio, $email, $age, $anw1, $anw2, $frequency);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
DELETE `t1`
FROM `channel_snapshots` AS `t1`
LEFT JOIN (
SELECT MAX(`snapshot_time`) AS `time`, `channel_id`
FROM `channel_snapshots`
GROUP BY `channel_id`
) AS `t2` ON `t2`.`time` = `t1`.`snapshot_time` AND `t2`.`channel_id` = `t1`.`channel_id`
WHERE `t1`.`snapshot_time` < NOW() - INTERVAL 12 HOUR
AND `t2`.`channel_id` IS NULL
SELECT `b`.`*`, `i`.`count`
FROM (
SELECT `ib`.`id_brand` AS `brand`, COUNT(*) AS `count`
FROM `item_brand` AS `ib`
JOIN `item` AS `i` ON `i`.`enabled` = 1
AND `i`.`id_category` IN (21,317,318)
AND `i`.`id` = `ib`.`id_item`
GROUP BY `ib`.`id_brand`
) AS `i`
JOIN `brand` AS `b` ON `b`.`id` = `i`.`id_brand`
ORDER BY `i`.`count` DESC
BIT_COUNT(HEX(:value1) ^ HEX(:value2))