7 months ago

DB::connection does not work as documented

Posted 7 months ago by rabol


I'm trying to migrate one old php app to Laravel so I have two databases

In my 'new db' I do not have the same table structure which is why i would like to connect to the old, and insert into the new db.

Both DB's are on the same MySQL

In my config/database.php I have the normal 'mysql' and then I have created a new 'orig_db'

$users = DB::Connection('orig_db')->select('select * from my_table where id = ?',[$id]);

i get an error saying that the .my_table does not exists is the new database so the table does not exists, which is why I would like to use the DB:connection

I'm using Laravel v5.8.15

Any hints?

Please sign in or create an account to participate in this conversation.