DB Connection in Custom File

Hi,

I was using in a custom file the following code to carry out queries in a custom file:

$connection = Conn();
$cnx_id = $connection->connectionId;

But now I am getting error with v2020.0.16.

Is that something changed?
What can I use to get the same functionality?

thanks
mpol_ch

You may try:

$cnx_id = GetConnectionId();

Hi,
I was using the following code without any problems with PHPMaker v2019.
I am handing over the variables like $Id, $Fname and $LName with URL (…cvdoc.php?Id=1&Fname=Bomo&Lname=Lomo).

But the same code is not working in PHPMaker v2020.
Should I define or Insert $_GET variable in custom file additinally?
If yes, where?
I do not see any space for this (there is no Row_Rendering Event for custom file).


$connection = Conn();
$cnx_id = $connection->connectionId;

include_once(‘tbs_us/tbs_class.php’);
include_once(‘tbs_plugin_opentbs/tbs_plugin_opentbs.php’);
$TBS = new \clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);

$Id = $_GET[‘Id’] ?? null; //Rechnungs ID
$Fname = $_GET[‘Fname’];
$Lname = $_GET[‘Lname’];
if (!$Id) {
die(“No id provided”);
}
$template = ‘vorlagen/cvdoc.docx’;
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
$TBS->MergeBlock(‘a’, $cnx_id, “SELECT * FROM personal Where Id=$Id”);

thanks
mpol_ch

  1. arbei wrote:

You may try:
$cnx_id = GetConnectionId();

  1. Avoid including third party scripts manually, you should click Tools → Composer Packages to add the composer package “tinybutstrong/tinybutstrong” and “tinybutstrong/opentbs”. Generate the composer.json again and run composer update and upload your “vendor” folder.
  2. Remove your include_once();

mpol_ch wrote:

But now I am getting error with v2020.0.16.

Always post the error message for more discussion.