I'm trying to make a logic to display the next day that a certain warehouse will have pouch shipping, I'm trying to create a array
with the search I'm doing on my banco de dados
and trying to skip today and always see the next day, but without success.
In my bank the days are 0 and 1, with 0 being no pouch and 1, yes.
My bank looks like this:
WhatIhaveincodelookslikethis:
if(GetApplication()->isGetValueSet('IdUnicoop')){$IdUnicoop=GetApplication()->GetGETValue('IdUnicoop');$sql="SELECT * FROM dvsMaloteDias WHERE dvsMaloteDias.IdUnicoop = $IdUnicoop"; $queryResult = $this->GetConnection()->fetchAll($sql); $Notificacao = array(); foreach($queryResult as $RegResult) { if ($RegResult['Segunda'] != 0) { array_push($Notificacao, "Segunda"); } if ($RegResult['Terça'] != 0) { array_push($Notificacao, "Terça"); } if ($RegResult['Quarta'] != 0) { array_push($Notificacao, "Quarta"); } if ($RegResult['Quinta'] != 0) { array_push($Notificacao, "Quinta"); } if ($RegResult['Sexta'] != 0) { array_push($Notificacao, "Sexta"); } if ($RegResult['Sabado'] != 0) { array_push($Notificacao, "Sábado"); } if ($RegResult['Domimgo']!= 0) { array_push($Notificacao, "Domingo"); } if ($RegResult['Todos'] != 0) { array_push($Notificacao, "Todos"); } } $result = array( 'Notificacao' => 'O próximo dia do malote é: ' . $Notificacao ); echo json_encode($result); exit; }
According to the image, for example, warehouse 9 has a pouch in the second, but I should check what day it is today and if it is second, I have to show that there will be a pouch on the fourth and fourth, check the day and if it is fourth, show sixth.
I even discovered the day of the week, but the comparison did not, see:
$now = new DateTime('now', new DateTimeZone('America/Sao_Paulo')); $minhadataYmdHis = $now->format('Y-m-d'); $diaSemanaN= date("w", strtotime($minhadataYmdHis)); switch($diaSemanaN) { case 0: $diaSemana="Domingo"; break; case 1: $diaSemana="Segunda"; break; case 2: $diaSemana="Terça"; break; case 3: $diaSemana="Quarta"; break; case 4: $diaSemana="Quinta"; break; case 5: $diaSemana="Sexta"; break; case 6: $diaSemana="Sábado"; break; } echo $diaSemana;