0
Good Afternoon,
I’m trying to pull existing hour intervals on my bench.
I’ll post the codes to be more explanatory
Query:
$user = "Diego";
$pack = "0013-001 B515 MCA ENGINEERING SUPPORT SYSTEM";
$date = "20-09-2019";
$horai = "14:01";
$horaf = "14:03";
$sql = $this->db->select('hrStart, hrEnd, hdate, pacote')
->from('horas')
->where('hrStart<=',$horai)
->where('hrEnd>=',$horaf)
->or_where('hrStart<=',$horaf)
->where('hrEnd>=',$horai)
->where(array('nome_user LIKE'=> '%'.$user.'%', 'pacote'=>$pack, 'hdate'=>$date, ))
->get();
return $sql;
My bank:
The Return:
Note that in the return it brings information from another package when I put this interval of 14:00 - 14:03 or other intervals where the numbers are between existing times, and the same interval does not exist.
If you want an interval between start time and end time, remove this or_where and the Where just below, it didn’t make much sense to me. Now if you have an applied logic behind this you should group or_where and Where eguinte, I don’t know how to do in codeigniter but this will break the logic if you don’t do the grouping.
– Leonardo Getulio