Advertisement
KateBarylo

Untitled

Dec 10th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. $contacts = ConnectionFactory::getConnection('content')->select('select * from IS_ContactSelect(1000)');
  2. if (count($contacts) > 0) {
  3.     $ct = ConnectionFactory::getConnection('cabinetct');
  4.     $ct->transaction();
  5.     try {
  6.         foreach ($contacts as $contact) {
  7.             $ct->query('delete from ct_contact where id = ?d', $contact['ID']);
  8.             $cabinet->query('insert into ?_contacts set ?a', array(
  9.               'id' => $contact['ID'],
  10.               'id_group' => $contact['ID_GROUP'],
  11.               'id_token' => $contact['ID_TOKEN'],
  12.               'id_fio' => $contact['ID_FIO'],
  13.               'id_div' => $contact['ID_DIV'],
  14.               'id_divs' => $contact['ID_DIVS'],
  15.               'name_fio' => $contact['NAME_FIO'],
  16.               'name_div' => $contact['NAME_DIV'],
  17.               'name_divs' => $contact['NAME_DIVS'],
  18.               'name_staf' => $contact['NAME_STAF'],
  19.               'kind' => $contact['KIND'],
  20.               'place' => $contact['PLACE'],
  21.               'contact' => $contact['CONTACT']
  22.             ));
  23.         }
  24.         $ct->commit();
  25.     } catch (Exception $e) {
  26.         $ct->rollback();
  27.         throw $e;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement