Doctrine\DBAL\Connection could not be converted to string (v2024)

Hi All,

Need your expert suggestion again
on customfile ( include common files ) i am trying to read and insert the data

I can read data without any problem

$jsonData = ExecuteJson($sql, ["fieldcaption" => false, "tablename" => ["menu"]]);

insert/update

$count= ExecuteStatement("INSERT INTO `items` (`users_id`, `product_id`, `price`, `product_options`, `added_at`) VALUES ('1', '1', '25', NULL, '2024-12-23 13:30:55')");

getting error phpfn.php(6036): Object of class Doctrine\DBAL\Connection could not be converted to string

Any clues ?

However ths one work but why not the above one that is more neat and clean

 // Get connection object
$conn = Conn(); 
$count = $conn->executeStatement("INSERT INTO `items` (`users_id`, `product_id`, `price`, `product_options`, `added_at`) VALUES ('1', '1', '15', NULL, '2024-12-23 13:30:05')");

Thanks

1 Like

Where did you put your code?

Hi,

i put this code on customfiles where i checked “include common”

Thanks

Hi

Found the issue i need to update to latest version
there is an echo which is causing issue when i commented it out it work fine.

Thanks