can you guys help me how to search string data in other database
what do you mean. Explain
You would need to specify a new connection under the Datasources section of your config/app.php file:
[config/app.php]
'DataSources' => [
'default' => [
// main database settings
],
'secondary_database_setting_name' => [
// configurations for new database, you can copy the content under default and just configure it properly for the new database
],
],
Now each table that needs access to this connection will need to override the defaultConnectionName method and return the value of the database key:
public static function defaultConnectionName() {
return 'secondary_database_setting_name';
}
This will direct the tables sql queries to the new connection rather than the default connection.
If your are scaffolding with the command line you can create table classes with the --connection <connection_name> parameter such as below
bin/cake bake all <table_name> --connection 'secondary_database_setting_name'
This will automatically override the defaultConnectionName method for you.
- P.S. You can also modify the config/app.php.default file to contain the new database connection setting so that it will automatically be created when setting up the app on a new server with composer install
sorry for late reply, okay i have 2 tables which is ‘userreport’ and ‘adminreport’ . i want to search multiple string from ‘userreport’ search box. and the searching will find all same string in the’report’ attribute in ‘adminreport’ table. can you show me step by step.? thank you