SHARE
TWEET

migrate2

kiojiotisha Aug 19th, 2019 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Controller
  2. ==========
  3.  
  4. function refresh_data_migration()
  5.     {
  6.         list($flag, $info_error, $userid)= $this->user_model->refresh_data_migration();
  7.  
  8.         $response = array(
  9.             'flag' =>  $flag,
  10.             'message' => $info_error,
  11.             'userid' => $userid
  12.         );
  13.         var_dump($response);
  14.     }
  15.  
  16. Model
  17. ==========
  18. function refresh_data_migration()
  19.     {
  20.         $driver_migration = $this->get_driver_migration();
  21.         foreach($driver_migration as $data )
  22.         {
  23.             $query = "
  24.                UPDATE users SET username = ?
  25.                WHERE id = ?
  26.            ";
  27.             $result = $this->db->query($query, array($data->username, $data->id));
  28.             if($result)
  29.             {
  30.                 return array($result, "success", $data->id);
  31.             }
  32.             else
  33.             {
  34.                 return array(false, "Failed update data", $data->id);
  35.             }
  36.         }
  37.     }
  38.  
  39.     function get_driver_migration()
  40.     {
  41.         $driverMigration = $this->db->query(
  42.             "
  43.                SELECT *
  44.                FROM users
  45.                WHERE create_date = '2019-08-07 09:55:55'
  46.                AND user_type_id = 50
  47.            "
  48.         )->result();
  49.  
  50.         return $driverMigration;
  51.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top