hey folks.
not sure if this is my lousy coding or what… but I could do with a little hand in solving this.
Am trying to update the mbr table if date is today or past, the below code seems to work to an extent just that it updates regardless if true or false…
Any help would be appreciated as other forums have now reached a loss, have tried a few different combinations and have the same result each time… GRRRR
Event is onScriptInit - Form
$exp_date = "{mbrDateValid}";
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);
if ($expiration_date > $today)
{
// SQL statement parameters
$update_table = 'mbr'; // Table name
$update_where = "mbrID = '{mbrID}'"; // Where clause
$update_fields = array( // Field list, add as many as needed
"mbrPaid = '0'",
"mbrDateValid = '0000-00-00'",
);
// Update record
$update_sql = 'UPDATE ' . $update_table
. ' SET ' . implode(', ', $update_fields)
. ' WHERE ' . $update_where;
sc_exec_sql($update_sql);
}
else
{
}
have the if statement working fine within a grid changing the field color, which works great, so am not sure why the same statement is failing within a form…