//..
$hash_list = [];
while ($row = mysqli_fetch_array($result)) {
$response[$count]= json_encode(unserialize($row[0]));
$count +=1;
//собираем все hash в один список
$hash_list[] = $row[1];
}
//апдейтим все pictures по списку hash одним запросом
if(!empty($hash_list)) {
mysqli_query ($db, "
UPDATE `pictures` SET `result`='PROCESS'
WHERE `hash` IN('".join("','", $hash_list)."')
");
}
echo json_encode($response);
SELECT * FROM courses
WHERE
( start_event BETWEEN $data_start AND $data_end ) AND
( end_event BETWEEN $data_start AND $data_end )
SELECT * FROM courses
WHERE
( start_event >= $data_start AND start_event <= $data_end ) AND
( end_event >= $data_start AND end_event <= $data_end )
SELECT
(@row_number:=@row_number + 1) AS pos,
`login`, `rating`, `team`
FROM `users`, (SELECT @row_number:=0) AS t
ORDER BY `rating` DESC
LIMIT 100
<table style="margin-left: auto;margin-right: auto; margin-top: 20px;">
<tr><th style="color: black; text-align: center;">Игрок</th><th style="color: black; text-align: center;">Команда</th><th style="color: black;">ROT <i style="cursor: pointer;" title="ROT- Raiting One Tour" class="fas fa-question-circle"></i></th></tr>
<?php
db();
$rait = mysqli_query($db, "SELECT `login`, `rating`, `team` FROM `users` ORDER BY `rating` DESC LIMIT 100");
if(mysqli_num_rows($rait)) {
$position = 0;
while ($row = mysqli_fetch_assoc($rait))
echo '<tr><td>'.(++$position).'. '.$row['login'].'</td><td>'.$row['team'].'</td><td>'.$row['raiting'].'</td></tr>';
}
?>
</table>
SELECT (COUNT(*)+1) as rating_pos FROM users WHERE `rating` > 'рейтинг_текущего_профиля'
SELECT * FROM materials
WHERE
( cat=1 AND podcat=10 ) /* podcat 10 в cat 1 */
OR ( cat=2 AND podcat=11 ) /* или podcat 11 в cat 2 */
OR ( cat = 3 AND podcat IN(13,111) ) /* или podcat 13, 111 в cat 3 */
SELECT * FROM materials
WHERE podcat IN(10, 11, 13, 111)
( SELECT name,phone,address FROM `psn`
WHERE `name` = '$zapros' OR `phone` LIKE '%$zapros%' OR `address` LIKE '%$zapros%' )
UNION
( SELECT name,phone,address FROM `office`
WHERE `name` = '$zapros' OR `phone` LIKE '%$zapros%' OR `address` LIKE '%$zapros%' )
SELECT * FROM (
SELECT name,phone,address FROM `psn`
UNION
SELECT name,phone,address FROM `office`
) AS t
WHERE t.`name` = '$zapros' OR t.`phone` LIKE '%$zapros%' OR t.`address` LIKE '%$zapros%'
SELECT post.*, users.name AS users_name, users.status AS users_status
FROM `post`
INNER JOIN `users` ON `post`.`author_id` = `users`.`id`
ORDER BY `post`.`id` DESC