ExecuteScalar on Linked Table (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
SteW
User
Posts: 12

ExecuteScalar on Linked Table (v2023)

Post by SteW »

I have on server 1 the PHPMaker 2023 project "logi" with the MariaDB database "logi". With PHPMaker "linked tables" I have successfully linked the table pal_palettrack of the MariaDB database "vms" (on a 2 server !) ( vms (var: vms, type: MySQL) ).
Test: "../palpalettracklist" works.

Now I want to execute the function ExecuteScalar on the table pal_palettrack (database: vms on 2 servers) in the "Row Rendered event" of a table from the database logi.

I thought this works by appending the optional parameter: vms

e.g.:

$mySQL = "SELECT COUNT(*) FROM pal_palettrack";
$myCount = ExecuteScalar($mySQL,'vms');

Result:
Doctrine \ DBAL \ Exception \ TableNotFoundException (1146)
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vms.pal_palettrack' doesn't exist

to find the Database ID i do following:
1) in Server Events Global > All Pages > Database_Connecting: var_dump($info)
2) i open: ... palpalettracklist and get this result:

array(9) { ["id"]=> string(3) "vms" ["type"]=> string(5) "MYSQL" ["qs"]=> string(1) "`" ["qe"]=> string(1) "`" ["host"]=> string(20) "xxx.xxx.com" ["port"]=> string(4) "3306" ["user"]=> string(3) "vms" ["password"]=> string(16) .....

when i call up a table from the main project i get:

array(9) { ["id"]=> string(2) "DB" ["type"]=> string(5) "MYSQL" ["qs"]=> string(1) "`" ["qe"]=> string(1) "`" ["host"]=> string(9) "localhost" ["port"]=> string(4) "3306" ["user"]=> string(11) "xxx" ["password"]=> ....

How does it work?

Regards
Stefan


arbei
User
Posts: 9384

Post by arbei »

Your setup looks correct. You may try ExecuteScalar($mySQL, Conn('vms')). If it still does not work, double check the spelling and lettercase of the table in your SQL.


SteW
User
Posts: 12

Post by SteW »

Thank you very much!

That is the solution to the problem. :-)


Post Reply