Update date fields in database

Hi There,

I have a couple of records where want the date fields to update based on the difference between to dates.

so for example the difference between the dates is 77 days. so i want to add up this 77 days in the chosen records.

here is my code, but whatever i do i can’t get it to work in scriptcase
//verschil in dagen tussen start van periodes

{verschil_dagen} = sc_date_dif({start_nieuw_rooster}, ‘aaaa-mm-dd’, $oude_rooster_start, ‘aaaa-mm-dd’);

$verschil_dagen = {verschil_dagen};
echo “verschil in dagen $verschil_dagen”;

// SQL statement parameters
$update_table = ‘ILP_rooster_TEMP’; // Table name
$update_where = “ev_id = ‘73’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“wk_datum_gesprek = DATEADD(dd, $verschil_dagen, wk_datum_gesprek)”,

);

// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);

anyone have any suggestion on how to do this

also tried this code result is NULL

// SQL statement parameters
$update_table = ‘ILP_rooster_TEMP’; // Table name
$update_where = “ev_id = ‘73’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“wk_datum_gesprek = DATE_ADD(‘wk_datum_gesprek’ , INTERVAL 2 DAY)”,

);

// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);

First you should remove the , at the end of this line

yeah tried that, the result us still NULL

wel you pushed me in the right direction

// SQL statement parameters
$update_table = ‘ILP_rooster_TEMP’; // Table name
$update_where = “ev_id = ‘73’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“wk_datum_gesprek = DATE_ADD(wk_datum_gesprek , INTERVAL 2 DAY)”,

);

// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);

instead of

“wk_datum_gesprek = DATE_ADD(‘wk_datum_gesprek’ , INTERVAL 2 DAY)”,

it should be

“wk_datum_gesprek = DATE_ADD(wk_datum_gesprek , INTERVAL 2 DAY)”,

thanks!