When I put the same code word for word in AppGini it won't work.
I modified the select and update statements to match what AppGini uses and it will extract the data but it doesn't extract the week and year from the date.
I've tested the code inserting the year and week directly in the select statement and it works.
I used the update statement at the end to insert the $work_date, $week and $year in the Period field. and the $work_date apears but the $week and $year strings are blank.
Does anyone know what is happening or is there a special way that AppGini can extract the week and year from a date?
Code: Select all
$recordID = makeSafe($recordID);
sql("select Day from Time_Entry where id = '$recordID'", $eo);
$work_date = $data['Day'];
$week = date_format($work_date,'W');
$year = date_format($work_date,'Y');
$sql=("select Period from PayPeriods where Year = '$year' and Week = '$week'");
$period=sqlValue($sql);
sql("UPDATE Time_Entry set Period = '$period' Where id = '$recordID'", $eo);
}