[ Index ]
 

Code source de dotProject 2.1 RC1

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/db/ -> upgrade_contacts.php (source)

   1  <?php
   2  
   3  if (! defined('DP_BASE_DIR'))
   4      die('You must not use this file directly, please direct your browser to install/index.php instead');
   5  
   6  dPmsg("Converting users to contacts");
   7  $users = db_loadList('SELECT * FROM users');
   8  foreach ($users as $user)
   9  {
  10          $sql = 'INSERT INTO contacts(
  11                  contact_first_name,
  12                  contact_last_name,
  13                  contact_birthday,
  14                  contact_company,
  15                  contact_department,
  16                  contact_email,
  17                  contact_phone,
  18                  contact_phone2,
  19                  contact_mobile,
  20                  contact_address1,
  21                  contact_address2,
  22                  contact_city,
  23                  contact_state,
  24                  contact_zip,
  25                  contact_country,
  26                  contact_icq,
  27                  contact_icon,
  28                  contact_owner)
  29                  VALUES  (\'' . 
  30                  $user['user_first_name'] . "', '" . 
  31                  $user['user_last_name'] . "', '" .
  32                  $user['user_birthday'] . "', " .
  33                  dPgetParam($user, 'user_company', 0) . ", '" .
  34                  dPgetParam($user, 'user_department', 0) . "', '" .
  35                  $user['user_email'] . "', '" .
  36                  $user['user_phone'] . "', '" .
  37                  $user['user_home_phone'] . "', '" .
  38                  $user['user_mobile'] . "', '" .
  39                  $user['user_address1'] . "', '" .
  40                  $user['user_address2'] . "', '" .
  41                  $user['user_city'] . "', '" .
  42                  $user['user_state'] . "', '" .
  43                  $user['user_zip'] . "', '" .
  44                  $user['user_country'] . "', '" .
  45                  $user['user_icq'] . "', '" .
  46                  $user['user_pic'] . "', '" .
  47                  $user['user_owner'] . "')";
  48  
  49                  db_exec($sql);
  50                  $msg =  db_error();
  51                                  if ($msg)
  52                                      dPmsg($msg);
  53                  $sql = 'UPDATE users 
  54                          SET user_contact=LAST_INSERT_ID() 
  55                          WHERE user_id = ' . $user['user_id'];
  56                  db_exec($sql);
  57                  $msg =  db_error();
  58                                  if ($msg)
  59                                      dPmsg($msg);
  60  }
  61  
  62  ?>


Généré le : Sun Feb 18 19:46:52 2007 par Balluche grâce à PHPXref 0.7