My Problem To Solve
I have the front end piece which accepts the press type and date ranges. When I click on search my logic presents me this
Date - 1
Schedule
Date - 2
Schedule
Now my programming logic is
$getDatesSQL = "SELECT distinct date FROM xxx.schedulemain where costcenter = '$costCenter' AND date between '$datef' AND '$datet' AND priority > '0' ";
Iterate over each dates and get schedule
for($i=0;$i<count($dates);$i++){
$sqlGetCostCenters = "SELECT sm.notes,sm.priority,sm.id,jh.jobnumber,jh.customer,round(sum(sm.hours),1) as time,jh.description,jh.production,jh.division,jh.duedate,sm.componenetnumber,sm.date
FROM xxx.jobheader as jh Left Join xxx.schedulemain as sm On jh.jobnumber = sm.jobnumber
where sm.costcenter = '$costCenter' AND sm.date = '$dates[$i]' AND sm.priority > '0'
Group By sm.costcenter,jh.jobnumber,jh.description,jh.production,jh.division,jh.duedate,sm.componenetnumber,sm.date,jh.customer,sm.id,sm.priority,sm.notes
Order By sm.date ASC, sm.priority ASC";
}
While iterating I also store total number of jobs for each particular date by doing the following
$totalJobs[] = count($jobNumber);
now when presenting the data I am facing an Issue.
Similar to fetching when presenting the data
I iterate over each dates
for($i=0;$i<count($dates);$i++){
//Now to get the data for that date I do inner iteration
for($k=0;$k<$totalJobs[$i];$k++) {
}
}
So when the inner iteration starts, the first loop is fine but the second time the loop should start from all the jobs that have already looped through during first iteration.
I am not getting how to do that. Can some one please help?
So sorry everyone if I confused with my question as it was a little harder to explain.
I have however found a solution. My solution was
This way when $k = $flag runs the second time it will start with value + 1 from previous iteration.
Once again sorry about the confusion.