Any help would be great on why this will not render the total column. If I hard code a date for the wkstart and wkend it works fine on the page. When I pass a variable it just shows 0’s for all totals.
date_default_timezone_set(“America/New_York”);
$wkstart = $_REQUEST[“start_date”];
$wkend = $_REQUEST[“end_date”];
$wkstart = date(“Y-m-d”, strtotime($wkstart));
$wkend = date(“Y-m-d h:i:s”, strtotime($wkend));
$g->select_command = “select students.AddressofresidenceCity,
students.AddressofresidenceState,
students.AddressofresidenceStreet,
students.AddressofresidenceStreet2,
students.AddressofresidenceZip,
students.BirthDate,
students.BirthplaceCity,
students.BuildingGrade,
students.CalledName,
students.CountyCode,
students.Disadvantagement,
students.DistrictAdmissionDate,
students.DistrictOfResidence,
students.DistrictWithdrawDate,
students.EffectiveStartDate,
students.EMISId,
students.EMISSituationId,
students.FamilyGroupName,
students.FirstName,
students.FiscalYearBegan9th,
students.Gender,
students.HomelessStatus,
students.Homeroom,
students.HomeroomTeacher,
students.Lastname,
students.LastNameSuffix,
students.MailingAddressCity,
students.MailingAddressState,
students.MailingAddressStreet,
students.MailingAddressStreet2,
students.MailingAddressZip,
students.MiddleName,
students.PrimaryContactCity,
students.PrimaryContactEmail,
students.PrimaryContactFirstName,
students.PrimaryContactHomePhone,
students.PrimaryContactLastName,
students.PrimaryContactMiddleName,
students.PrimaryContactMobilePhone,
students.PrimaryContactNameSuffix,
students.PrimaryContactRelationshipcomments,
students.PrimaryContactState,
students.PrimaryContactStreet,
students.PrimaryContactStreet2,
students.PrimaryContactTitle,
students.PrimaryContactType,
students.PrimaryContactZip,
students.Program,
students.Section504Plan,
students.StateStudentID,
students.Status,
students.StudentEmail, students.StudentNumber, IFNULL(round(sum(TimestampDiff(minute, Time_Start, Time_End))/60,2), 0) as TotalHours from students left join attendance on students.StudentNumber = attendance.StudentNumber and students.status = ‘active’ and time_start between ‘” . $wkstart . “‘ and ‘” . $wkend . “‘ Group by students.StudentNumber”;
$g->table = “attendance”;
You need to preserve posted data in session. Refer this faq:
So I loaded the request form variables to the session and it still didn’t work? You said in the example not to use the session variables, but just use the variable in the SQL. I guess I must be missing something?
date_default_timezone_set(“America/New_York”);
$wkstart = $_REQUEST[“start_date”];
$wkend = $_REQUEST[“end_date”];
$wkstart = date(“Y-m-d”, strtotime($wkstart));
$wkend = date(“Y-m-d h:i:s”, strtotime($wkend));
//echo $wkstart;
//echo $wkend;
session_start();
$_SESSION[“wkstart”] = $wkstart;
$_SESSION[“wkend”] = $wkend;
$wkstart = $_SESSION[“wkstart”];
$wkend = $_SESSION[“wkend”] ;