Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = $this->request->data;
- $connection = ConnectionManager::get("default");
- $query = "SELECT * FROM clients WHERE client_id = ".$data['codigo'];
- $result = $connection->execute($query)->fetchAll('assoc');
- ConnectionManager::drop('default');
- $config = ConnectionManager::config('connection', [
- 'className' => 'CakeDatabaseConnection',
- 'driver' => 'CakeDatabaseDriverMysql',
- 'persistent' => false,
- 'host' => $result[0]['host'],
- 'username' => $result[0]['username'],
- 'password' => $result[0]['password'],
- 'database' => $result[0]['database'],
- 'encoding' => 'utf8',
- 'timezone' => 'UTC',
- 'flags' => [],
- 'cacheMetadata' => true,
- 'log' => false,
- 'quoteIdentifiers' => false,
- 'url' => env('DATABASE_URL', null),
- ]);
- $connection = ConnectionManager::get('connection');
- ConnectionManager::alias('connection', 'default');
- return $this->redirect(['controller' => 'Mains', 'action' => 'index']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement