Hi,
I have a small problem with my PHP code and I need a little help, please.
In the onLoadRecord event I defined a SQL call to get values from an other record (previous year) based on the year ($v_AJ) of the current record
$v_AJ = {MA_U_Jahr};
$v_VJ = 0;
$v_VJ = date(“Y”, strtotime($v_AJ - 1));
$check_sql = “SELECT MA_U_AJ_Rest, MA_U_Jahr”
. " FROM tab_Mitarbeiter_Urlaub"
. " WHERE (MA_ID = ‘" . {MA_ID} . "’) AND (MA_U_Jahr = ‘" . $v_VJ . "’)";
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]})) // Row found
{
$v_UR_VJ_R = {rs[0][0]};
}
else // No row found
{
$v_UR_VJ_R = 0;
}
echo $v_AJ . " - " . $v_VJ . " - " . $check_sql;
The first record works fine, but the second recors use the same value from the variable $v_VJ
What did I wrong ?
Thanks in advance