Example Code
Hi Ray
Do you have a simple example of the Update code wrapped in a loop?
Here's my single record update code:
<?php
if (isset($_POST["WA_Update2"]) || isset($_POST["WA_Update2_x"])) {
$UpdateQuery = new WA_MySQLi_Query($crm_realpress_wa);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "cu_action_act";
$UpdateQuery->bindColumn("idusr_updater_act", "i", "".((isset($_POST["idusr_updater_act"]))?$_POST["idusr_updater_act"]:"") ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("updated_act", "t", "", "WA_CURRENT_TIMESTAMP");
$UpdateQuery->bindColumn("active_act", "i", "".((isset($_POST["active_act"]))?$_POST["active_act"]:"") ."", "WA_DEFAULT");
$UpdateQuery->addFilter("id_act", "=", "i", "".($_POST['id_act']) ."");
$UpdateQuery->execute();
$UpdateGoTo = "timeline.php?id_usr=" . $_GET['id_usr'] . "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
At present the addFilter is on id_act ($_POST['id_act'])
I would want to to run the loop where idusr_act = xx (this can be got from $_GET['id_usr']) and active_act=1
In effect this would set the active_act field to zero for all records selected in the loop.
Also, how would I trigger the loop?
Hope this makes sense.
Thanks