This topic is locked
[SOLVED]

 PHP code snippet in PHPRunner 8

9/23/2014 4:42:18 AM
PHPRunner General questions
S
snuffi01 author

Have been using php code snippet in editor to show some values like an dashboard in PHPRunner 7.1 and older.

In my project for 8.0 i have added 3 different databases:

hosted_wg

shorewarecdr and

shoreware
As example i try to show value of incoming calls in an listpage (most of all i would like it to display in dashboard).

The code should select from the db and table shorewarecdr.call

In the listpage of table "call" i have added this php code snippet:
$rstmp = CustomQuery("SELECT

COUNT(CallID) AS COUNT(CallID)

FROM call

WHERE (WorkgroupCall =1)

GROUP BY WorkgroupCall

ORDER BY StartTime DESC");

if ($datatmp = db_fetch_array($rstmp))

echo "Inkommande samtal: ".$datatmp["COUNT(CallID)"];
Now in PHPRunner 8 i get fault message like:
Table 'hosted_wg.call' doesn't exist
Is there a way to make the code choose the right database?

I guess that i chooses the databse "hosted_wg" as that was the first database i added to the project?

Sergey Kornilov admin 9/23/2014

DAL functions like CustomQuery will only work with primary (default) database connection. Proceed to 'Datasource tables' screen, right click on connection and choose 'Make this connection primary'.
Rebuild your project after that and enjoy.