Good day everyone! There is a table, a database, and when the page loads, you can set a parameter in the code for which results will be output (ORDER BY *** . *** DESC);
$mysqli -> query("SET NAMES 'utf8'"); $query_steklo = $mysqli -> query("SELECT * FROM `saves` ORDER BY `saves`.`dateU` DESC"); echo $mysqli->error; $i = 1; while ($row = $query_steklo -> fetch_assoc()){ $clr_code = explode('-', $row['date'])[2]; if (is_float($clr_code/2)) { $clr = '#e2e2e2'; } else{ $clr = '#dbb4e2'; } $saves_var = $saves_var ."<tr class=\"".$row['dateU']."\" style=\"background-color: ".$clr."\">" ."<td>" .$row['user'] ."</td>" ."<td>" .$row['client'] ."</td>" ."<td>" .$row['object'] ."</td>" ."<td>" .$row['date'] ."</td>" ."<td>" .$row['eur'] ."</td>" ."<td>" .$row['rur'] ."</td>" ."<td>" .$row['sq'] ."</td>" ."<td>" .$row['pr'] ."</td>" ."<td>" .$row['num'] ."</td>" ."<td>" .$row['formula'] ."</td>" ."<td>" .$row['materials_dop'] ."</td>" ."<td>" .$row['materialoemkost'] ."</td>" ."<td>" .$row['forclient'] ."</td>" ."<td>" .$row['dateU'] ."</td>"; $i++; } <table class="table table-hover stekla defdiv" style="font-size: 10px"> <thead> <tr> <td style="">Исполнитель</td> <td style="">Заказчик</td> <td style="">Объект</td> <td style="">Дата</td> <td style="">EUR</td> <td style="">RUR</td> <td style="">Площадь</td> <td style="">Периметр</td> <td style="">Кол-во</td> <td style="">Формула</td> <td style="">Доп.</td> <td style="">Мат.</td> <td style="">Цена</td> </tr> </thead> <?echo $saves_var ; ?> </table> It is necessary in some way when you click on the column to update the page with the sort already for the desired parameter. Disclaimer :) I do not ask you to do everything for me, tell me which way to think Thank you.