$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);
SELECT `id`
FROM `cms3_objects` AS `o`
JOIN `cms3_object_content` AS `t1` ON `t1`.`obj_id` = `o`.`id`
AND `t1`.`field_id` = '911' AND `t1`.`rel_val`='283367'
JOIN `cms3_object_content` AS `t2` ON `t2`.`obj_id` = `o`.`id`
AND `t2`.`field_id` = '912' AND `t2`.`rel_val`='800'
JOIN `cms3_object_content` AS `t3` ON `t3`.`obj_id` = `o`.`id`
AND `t3`.`field_id` = '913' AND `t3`.`rel_val`='66756'
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
$request = $pdo->prepare("SELECT `id`, `name` FROM `fruits` ORDER BY `name`");
$request->execute();
$data = [];
$prevLetter = '';
$subArray = [];
foreach ($row = $request->fetch(PDO::FETCH_ASSOC)) {
$firstLetter = mb_substr($row['name'], 0, 1);
if ($prevLetter != $firstLetter) {
if (count($subArray) > 0)
$data[] = $subArray;
$subArray = [];
$prevLetter = $firstLetter;
}
$subArray[] = $row;
}
if (count($subArray) > 0)
$data[] = $subArray;