Dirsovisk

Exemplo varrer tabela

Apr 4th, 2020
212
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $hora_que_desejo_agendar = 'Horario que ela está tentando agendar. Esse valor vem da tela.';
  2. $SQL = 'Select que retona todos registros de agendamentos do dia';
  3.  
  4. $result = banco.consulta($SQL);
  5.  
  6. while( $registro = $result.next() ){
  7.    
  8.     $hora_agendada = $registro['COLUNA_HORARIO'];
  9.     $SQL_dif = 'SELECT TIMESTAMPDIFF(HOUR,' . $hora_agendada . ', ' . $hora_que_desejo_agendar . ') AS dif';
  10.    
  11.     $result_dif = banco.consulta($SQL_dif);
  12.  
  13.     if( $registro_dif = $result_dif.next() ){
  14.         $valor_dif = $registro_dif['dif'];
  15.  
  16.         if($valor_dif < 1)
  17.             return 'Não permite agendar';
  18.         else
  19.             return 'Permite agendar';
  20.     }
  21.  
  22. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×