I'm trying to execute a function with values from other DB.
I'm using Framework CakePHP 4.x with 2 DB, Postgresql and MariaDB.
In Controller/Programscontroller.php:
use Cake\Datasource\ConnectionManager;
public function pro()
{ $connection = ConnectionManager::get('default');// Postgresql,in this one i have my function test(character varying,bigint,bigint)
$connection2 = ConnectionManager::get('test');// MariaDB, in this one i want some variables
$data = $connection2->execute('SELECT stuffs from stuff'); //My $data i want
foreach ($data as $data) //I declare here 3 variables, to save some $data
{ $w1=$data['cod_item'];
$w2=$data['fecha_solicitud_pago'];
$w3=$data['monto_total'];
$connection->execute('SELECT test(w1,w2,w3)');//here is my problem
}
}
i execute and have the error SQLSTATE[42703]: Undefined column 7, dont exist column w1.How is the correct way to define my 3 variables w1,w2,w3, and use them in my function from other DB.