- $project_id = $val['p_id'];
-
- // Get activity binds for project (old way).
- // $sql = "select ab_id_a from activity_bind where ab_id_p = $project_id";
- $sql = "select ab_id_a, a_id, a_name from activity_bind
- inner join activities on (ab_id_a = a_id)
- where ab_id_p = $project_id
- order by a_name";
-
- $result = $mdb2->query($sql);
- if (is_a($result, 'PEAR_Error')) {
- die($result->getMessage());
- }
- $activity_arr = array();
- while ($value = $result->fetchRow()) {
- $activity_arr[] = $value['ab_id_a'];
- }
- $a_comma_separated = implode(",", $activity_arr); // This is a comma-separated list of associated activity ids.
-
- // Re-bind the project to activities (new way).
- $sql = "update projects set p_activities = ".$mdb2->quote($a_comma_separated)." where p_id = $project_id";
- $affected = $mdb2->exec($sql);
- if (is_a($affected, 'PEAR_Error')) {
- die($affected->getMessage());
- }
+ $project_id = $val['p_id'];
+
+ // Get activity binds for project (old way).
+ // $sql = "select ab_id_a from activity_bind where ab_id_p = $project_id";
+ $sql = "select ab_id_a, a_id, a_name from activity_bind
+ inner join activities on (ab_id_a = a_id)
+ where ab_id_p = $project_id order by a_name";
+
+ $result = $mdb2->query($sql);
+ if (is_a($result, 'PEAR_Error')) {
+ die($result->getMessage());
+ }
+ $activity_arr = array();
+ while ($value = $result->fetchRow()) {
+ $activity_arr[] = $value['ab_id_a'];
+ }
+ $a_comma_separated = implode(",", $activity_arr); // This is a comma-separated list of associated activity ids.
+
+ // Re-bind the project to activities (new way).
+ $sql = "update projects set p_activities = ".$mdb2->quote($a_comma_separated)." where p_id = $project_id";
+ $affected = $mdb2->exec($sql);
+ if (is_a($affected, 'PEAR_Error')) {
+ die($affected->getMessage());
+ }