How to properly initialise dhtmlxConnector?

Hello,

I’m not sure I’m initialising the dhtmlxConnector object within the dhtlmxForm component.

My web page contains this reference to the connector:

<script src="../dhtmlxSuite/dhtmlxConnector/codebase/connector.js"></script>

And it instantiates the form like so:

myForm = new dhtmlXForm("listObj", formData);

It then loads my connector PHP file:

myForm.load("../dhtmlxSuite/dhtmlxConnector/codebase/workplan_connector.php");

The connector PHP file itself contains:

require("connector/form_connector.php"); require("connector/db_mssql.php"); $res=mssql_connect("CH-SQL-X","sa","1",false); mssql_select_db("ServiceNow_AB"); $formConn = new FormConnector($res,"MsSQL"); $formConn->render_table("pm_project","name");

(I’m trying to connect to a database called “ServiceNow_AB” on an in-house SQLServer database server called “CH-SQL-X”. I want to retrieve data from a column called “name” within a table called “pm_project”.)

When I load the web page, I get a popup, which seems to just echo the PHP code in ‘workplan_connector.php’.

Please tell me, why am I getting this popup? Is my code incorrect? Thank you very mcuh.

It seems that you have not php support on server side at all ( or you are loading page not through web server ) - such response can occur only if server side return php code not-processed.

Hello, Stanislav,

There is in fact a PHP scripting engine on the server - I can run a ‘Hello World’ PHP script on it successfully.

I’ve previously posted my code - is there anything wrong with it, please? Can you provide me sample code showing how the connector is supposed to be used with a MS SQL Server database?

Thank you.

The code which you are using is correct. And I still suspect that something wrong with your server.
The alert message on client side occurs if server side response is not a valid XML, and shows the data which was sent by server.

If it is full php code - it means server doesn’t process php at all.
Check that your php code is wrapped in <?php ?> , not in <? ?>

Hello, Stanislav,

Indeed, I discovered late yesterday I had neglected in my hurry to wrap the code in PHP delimiters; thank you. My code is still not working, however. I will see if I can correct the problem myself before troubling you again.