Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Controller
- ==========
- function refresh_data_migration()
- {
- list($flag, $info_error, $userid)= $this->user_model->refresh_data_migration();
- $response = array(
- 'flag' => $flag,
- 'message' => $info_error,
- 'userid' => $userid
- );
- var_dump($response);
- }
- Model
- ==========
- function refresh_data_migration()
- {
- $driver_migration = $this->get_driver_migration();
- foreach($driver_migration as $data )
- {
- $query = "
- UPDATE users SET username = ?
- WHERE id = ?
- ";
- $result = $this->db->query($query, array($data->username, $data->id));
- if($result)
- {
- return array($result, "success", $data->id);
- }
- else
- {
- return array(false, "Failed update data", $data->id);
- }
- }
- }
- function get_driver_migration()
- {
- $driverMigration = $this->db->query(
- "
- SELECT *
- FROM users
- WHERE create_date = '2019-08-07 09:55:55'
- AND user_type_id = 50
- "
- )->result();
- return $driverMigration;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement