Session Variables in DHTMLxGrid

Dear friends
we are using the free edition of DHTMlx suite and we encouter the following technical big problem.

We have a page called main.php as fist page. main.php take a source javascript file called main.js

This file builts a dhtmlxgrid via :

mygrid.loadXML(“myconnector.php”,function () {

                    ………some code here……………………


In myconnector.php we render an sql statement like

Select user_id,username,expence from costs

This one refers to a table named costs in our database with the costs of the users in a project.

The problem is that we want this statement to be dynamic regarding the userid filed so each user via login to see only his/her costs. The only way we know to achieve this, is by the use of a session variable e.g. $_SESSION[‘user_id’] and create a dynamic sql like

$s=“Select user_id,username,expence from costs where user_id=”.$_SESSION[‘user_id’]

So we created $_SESSION[‘user_id’] in the login page and with session_start() the value of the variable is propagated.

The problem is that in all other pages of our application $_SESSION[‘user_id’] variable is propagated OK, but in myconnector.php is not.

We understand that this is happening because myconnector.php is called from a js file (main.js) and not from an other php file, so it is actually out of session are we correct?

Please inform us how can we override this problem

Thanks in advance

Vasilis Lakes
IT Department
Hellenic Center for Marine Research.

I use a lot of session variables in php files which are loaded by javascript, all variables are propagated. Almose all the loaded data (eg. form data,grid data, tree data, et al) are dynamically created according to the variables including sessions and requests. I also use php files as javascript sources, all sessions work properly.