-1
Hello, I have already looked into the matter but I have not yet obtained anything that works properly. I have a database with multiple orders and these have a deadline and also a fixed date, but the deadline data cannot be saved in the database because they are always changing according to the date and time, and here comes the problem how I can sort this table, in order of increasing time date so that the indices ie, the line of each item can not be changed,
I thought something like usort, but it didn’t work...
while ($pRow = mysqli_fetch_object($pQuery)) {
$ped_id[$w] = $pRow->ped_id;
$ped_cliente[$w] = $pRow->ped_cliente;
$ped_entrega[$w] = $data_hs_entrega_print;
$ped_msg[$w] = $msg;
$ped_status[$w] = $status;
$cor[$w] = $cor_chamado;
$classe[$w] = $class;
$botoes[$w] = $botao;
$w++;
}
function sortFunction( $a, $b ) {
return strtotime($a) - strtotime($b);
}
for($g=0;$g<$w;$g++){
$array['ped_id'][$g] = $ped_id[$g];
$array['ped_cliente'][$g] = $ped_cliente[$g];
$array['ped_entrega'][$g] = $ped_entrega[$g];
$array['ped_msg'][$g] = $ped_msg[$g];
$array['ped_status'][$g] = $ped_status[$g];
$array['cor'][$g] = $cor[$g];
$array['classe'][$g] = $classe[$g];
$array['botoes'][$g] = $botoes[$g];
usort($array['ped_entrega'], "sortFunction");
}