Level 75
Looks like you have a returned object.
Hello, everyone I need help with the "array to string conversion" error I always get when trying to display tables from the Database.
if($this->parentData->type->slug == 'mysql')
$select = "SHOW TABLES FROM `".$this->parentData->database."`";
else if($this->parentData->type->slug == 'pgsql')
$select = "select table_name FROM information_schema.tables WHERE table_schema = ". $this->parentData->schema;
Log::info('Select: '.$select); // Select: SHOW TABLES FROM `test2024`
$data = DB::connection($conn)->select($select); // Array to string conversion (Connection: mysql1, SQL: SHOW TABLES FROM `test2024`)
My $this->parentData
{
"id":6,
"name":"DB Test",
"description":"DB Test Local",
"database_type_id":1,
"host":"127.0.0.1",
"port":"3306",
"username":"root",
"password":"",
"database":"test2024",
"schema":"test2024",
"year":"2024",
"type" {
"id":1,
"name":"MySQL"
"slug":"mysql"
}
}
$conn value is 'mysql1'
My mysql1 config is dynamic, but in that runtime is like this
array (
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'test2024',
'username' => 'root',
'password' => '',
)
Glad to be helped, thank you
Please or to participate in this conversation.